Write the Octal to Decimal number program in C++ using inline function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
#include<iostream> #include<math.h> using namespace std; class view { public: int i,dnumber=0,rem,T4Tutorials_Octal; public: int convert(); }; inline view::convert() { cout<<"Enter the Number"; cin>>T4Tutorials_Octal; for(i=0;T4Tutorials_Octal>0;i++) { rem=T4Tutorials_Octal%10; dnumber=dnumber+rem* pow(8,i); T4Tutorials_Octal=T4Tutorials_Octal/10; { } cout<<"The decimal is "<<dnumber; } } int main() { view obj; obj.convert(); } |