未定義標識符
代碼:
#include "iostream"
#include "stdlib.h"
#include "stdafx.h"
using namespace std;
int main()
{
cout << "請輸入一個整數:";
int x;
cin >> x;
cout << oct << x << endl;
cout << dec << x << endl;
cout << hex << x << endl;
cout << "請輸入一個布爾值(0,1):";
bool y = false;
cin >> y;
cout << boolalpha << y << endl;
system("pause");
return 0;
?}
報錯:
1>e:\project\c++\test\test\test\test.cpp(13): error C2065: “cout”: 未聲明的標識符
1>e:\project\c++\test\test\test\test.cpp(13): error C2065: “hex”: 未聲明的標識符
1>e:\project\c++\test\test\test\test.cpp(13): error C2065: “endl”: 未聲明的標識符
1>e:\project\c++\test\test\test\test.cpp(15): error C2065: “cout”: 未聲明的標識符
1>e:\project\c++\test\test\test\test.cpp(17): error C2065: “cin”: 未聲明的標識符
1>e:\project\c++\test\test\test\test.cpp(17): warning C4804: “>>”: 在操作中使用類型“bool”不安全
1>e:\project\c++\test\test\test\test.cpp(18): error C2065: “cout”: 未聲明的標識符
1>e:\project\c++\test\test\test\test.cpp(18): error C2065: “boolalpha”: 未聲明的標識符
1>e:\project\c++\test\test\test\test.cpp(18): error C2065: “endl”: 未聲明的標識符
1>e:\project\c++\test\test\test\test.cpp(20): error C3861: “system”: 找不到標識符
剛開始求解答,謝謝。
2018-04-03