洛阳关林火车站电话:C++ 简单问题

来源:百度文库 编辑:高校问答 时间:2024/04/29 02:24:56
#include<iostream.h>
#include<iostream.h>
void main()
{

int n;
cout<<"输入: ";
cin>>n;
cout<<n<<"\t12进制:"
<<hex<<n<<"\n"
<<dec<<n<<"\n"
<<oct<<n<<"\n"
<<setbase (10) <<n<<"\n"//这里编译不通过
<<n<<endl;
}

这个是对的
改成下面就对了 谁不知道为什么
#include <iostream>
#include <iomanip>
using namespace std; //问题就在这里

void main()
{

int n;
cout<<"输入: ";
cin>>n;
cout<<n<<"\t12进制:"
<<hex<<n<<"\n"
<<dec<<n<<"\n"
<<oct<<n<<"\n"
<<setbase(10) <<n<<"\n"
<<n<<endl;
}//谢谢

名空间有重复吧,你是不是在两个名空间里都定义了setbase()函数?

我这里怎么是对的哦