c++报错:[Error] 'cout' was not declared in this scope
一、报错代码
#include <iostream>
int main() {
int x=10;
cout<< x <<"\n";
return 0;
}

二、解决方法
在代码中加入:
using namespace std;
正确代码:
#include <iostream>
using namespace std;
int main() {
int x=10;
cout<< x <<"\n";
return 0;
}
运行结果:

φ(゜▽゜*)♪ 感谢观看,希望对你有帮助!

浙公网安备 33010602011771号