未定义标识符
代码:
#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”: 找不到标识符
刚开始求解答,谢谢。