首页 > 代码库 > 8 八进制

8 八进制

 

 

 

 

#include <iostream>using namespace std;void f(int x){    if(x<8) cout<<x;    else {  cout<<x%8 ;  f(x/8); }}int main(int argc, char *argv[]){     int x;     cin>>x;     f(x);        return 0;}
View Code

 

 

 

#include <iostream>
using namespace std;
void f(int x)
{
 if(x<8) cout<<x;
 else {  cout<<x%8 ;  f(x/8); }
}
int main(int argc, char *argv[])
{
  int x;
  cin>>x;
  f(x);
 
 return 0;
}

 

 

 

 

 

*************************************************************************************************************************

 

 

 

 

 

 

#include <iostream>using namespace std;void f(int x){    if(x>0)  {  f(x/8);  cout<<x%8  ;  } ;}int main(int argc, char *argv[]){     int x;     cin>>x;     f(x);        return 0;}View Code
View Code

 

#include <iostream>

using namespace std;

void f(int x)

{     

 

   if(x>0) 

{             f(x/8);                    cout<<x%8  ;          }

 

}

 

int main(int argc, char *argv[])

{  

int x;  

cin>>x;  

    f(x);  

 return 0;

}