注意添加名空间,详细如图所示。
以下是一个C++的简单例子
#include
using namespace std;
int main()
{
cout<<"This is a C++ program"<return 0;
}
endl 改成 std::endl。因为你没有using namespace std; 所以 必须加上 std:: ,cin ,cout 你都加了,endl也一样要加
你改成
#include
using namespace std;
int main(){
std::cout<<"我的程序\n";
int a;
std::cin>>a;
std::cout<<"我输入的数字是\t"< std::cout<
}
试一下。
因为endl是系统namespace的,你要先声明
改为cout<<"/n";