这个简单的C++源代码哪里出错了,大神进~~

2025-02-24 06:39:49
推荐回答(5个)
回答1:

首先:你引用到了std名称空间中定义的关键字,所以要using namespace std;
接下来:string是一种类型,前面的int要去掉,而且语句最后也要分号结尾:string st;

改完的程序:
#include
#include
using namespace std;

string st;
int main ()
{
string st("The expense of spirit\n");
cout<<"The size of "< return 0;
}

回答2:

改了,删除,并加命名空间std
#include
#include
using namespace std;

int main ()
{
string st("The expense of spirit\n");
cout<<"The size of "< return 0;
}

回答3:

#include
#include
using namespace std;
int main ()
{
string st("The expense of spirit ");
cout<<"The size of "< return 0;
}

回答4:

int string st
这句是神马,删了

回答5:

int string st???删之