11-8

提示用户输入一个十进制整数,分别用十进制、八进制和十六进制形式输出。

 1 #include <iostream>
 2 #include <string>
 3 #include<string.h>
 4 #include <fstream>
 5 using namespace std;
 6 
 7 int main(){
 8     int n;
 9     cout<<"输入一个十进制数"<<endl;
10     cin>>n;
11     cout<<"十进制:"<<dec<<n<<endl;
12     cout<<"八进制:"<<oct<<n<<endl;
13     cout<<"十六进制:"<<hex<<n<<endl;
14     return 0;
15 }

 

posted @ 2023-03-28 19:50  nlkdfgnvfdkl  阅读(49)  评论(0)    收藏  举报