// exam1.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <stack>
using namespace std;
void conversion(int n)
{
cout<<"The number "<<n<<"'s"<<" octal representation is:"<<endl;
stack<int> s;
while(n!=0)
{
int temp=n%8;
n=n/8;
s.push(temp);
}
while(!s.empty())
{
int temp=s.top();
cout<<temp;
s.pop();
}
cout<<endl;
return;
}
int main(void)
{
int num=1000;
conversion(num);
system("pause");
return 0;
}
数制转换
最新推荐文章于 2023-03-27 18:14:20 发布