解题思路:
注意事项:注意输入x的方式
参考代码:
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<stack>
using namespace std;
stack<int> s;
void bajinz(int x)
{
while(x>0)
{
int t=x%8;
s.push(t);
x/=8;
}
return ;
}
int main()
{
int x;
for(;cin>>x;)
{
bajinz(x);
while(!s.empty())
{
printf("%d",s.top());
s.pop();
}
printf("\n");
}
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:613 |
C语言程序设计教程(第三版)课后习题10.4 (C语言代码)浏览:884 |
printf基础练习2 (C语言代码)浏览:747 |
2006年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:669 |
简单的a+b (C语言代码)浏览:442 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:719 |
C二级辅导-计负均正 (C语言代码)浏览:640 |
半数集问题 (C语言代码)浏览:921 |
【计算两点间的距离】 (C语言代码)浏览:855 |
平方数问题,oj一直是wrong answer浏览:739 |