老師,代碼有問題嗎?怎么無法運行?
int main(void)
{
int x = 0;
cout<<"請輸入一個整數:"<<endl;
cin>>x;
cout<<oct<<x<<endl;
cout<<dec<<x<<endl;
cout<<hex<<x<<endl;
cout<<"請輸入一個布爾值(0,1):"<<endl;
bool y = false;
cin>>y;
cout<<boolalpha<<y<<endl;
system("pause");
return ();
}
int main(void)
{
int x = 0;
cout<<"請輸入一個整數:"<<endl;
cin>>x;
cout<<oct<<x<<endl;
cout<<dec<<x<<endl;
cout<<hex<<x<<endl;
cout<<"請輸入一個布爾值(0,1):"<<endl;
bool y = false;
cin>>y;
cout<<boolalpha<<y<<endl;
system("pause");
return ();
}
2016-11-08
舉報
2016-12-06
system()包含在stdlib.h里面,你的代碼里沒有stdlib.h頭文件
2016-11-22
沒錯啊,你的運行環境出錯了吧。
2016-11-08
完整代碼:
#include <iostream>
using namespace std;
int main(void)
{
int x = 0;
cout<<"請輸入一個整數:"<<endl;
cin>>x;
cout<<oct<<x<<endl;
cout<<dec<<x<<endl;
cout<<hex<<x<<endl;
cout<<"請輸入一個布爾值(0,1):"<<endl;
bool y = false;
cin>>y;
cout<<boolalpha<<y<<endl;
system("pause");
return 0;
}