标题:[求助]刚学VC就出错,请指点.谢谢
取消只看楼主
heidong
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-7-20
 问题点数:0 回复次数:0 
[求助]刚学VC就出错,请指点.谢谢

#include <iostream>
#include <string>
using namespace std;
int main()
{
string username;
cout<<"What is your name?:";
cin>>username;
cout<<"Hello"<<username<<"!"<<endl;
return 0;
}

-------------------Configuration: hello - Win32 Debug--------------------
Compiling...
hello.cpp
e:\heidong\vc++\hello\hello.cpp(3) : error C2871: 'std' : does not exist or is not a namespace
e:\heidong\vc++\hello\hello.cpp(6) : error C2065: 'string' : undeclared identifier
e:\heidong\vc++\hello\hello.cpp(6) : error C2146: syntax error : missing ';' before identifier 'username'
e:\heidong\vc++\hello\hello.cpp(6) : error C2065: 'username' : undeclared identifier
e:\heidong\vc++\hello\hello.cpp(7) : error C2065: 'cout' : undeclared identifier
e:\heidong\vc++\hello\hello.cpp(7) : error C2297: '<<' : illegal, right operand has type 'char [20]'
e:\heidong\vc++\hello\hello.cpp(8) : error C2065: 'cin' : undeclared identifier
e:\heidong\vc++\hello\hello.cpp(8) : warning C4552: '>>' : operator has no effect; expected operator with side-effect
e:\heidong\vc++\hello\hello.cpp(9) : error C2297: '<<' : illegal, right operand has type 'char [6]'
e:\heidong\vc++\hello\hello.cpp(9) : error C2065: 'endl' : undeclared identifier
Error executing cl.exe.

hello.obj - 9 error(s), 1 warning(s)

搜索更多相关主题的帖子: hello cpp username std 
2006-07-20 11:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-79305-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.645348 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved