Decimal to Octal Conversion in C++

Posted by Didi Setyapramana On 8:06 PM 0 komentar


# include <conio.h>
# include <iostream>

to_Oktal void (int n)
{
  char * oktal_list [] = {"0", "1", "2", "3", "4", "5", "6", "7"};
  if (n> 7)
  {
   to_Oktal (n / 8);
  }
  cout <<oktal_list [n% 8];
  getch ();
}

int main ()
{
  int a;
  cout <<"Enter a number to be converted:";
  cin>> a;
  cout <<a <<"in octal is:";
  to_Oktal (a);
}

Categories:

0 Response for the "Decimal to Octal Conversion in C++"

Post a Comment