这个代码对了吗,为什么编译通不过,
这是提示原因:
fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
#include<iostream>
#include<string>
using namespace std;
struct Person
{
Person(){
cout<<"hahhaha"<<endl;
}
~Person(){
cout<<"wuwuwuwuwu"<<endl;
}
void Introduction(){
if(name=="志玲"){
cout<<"大家好,我是志玲请多多关照"<<endl;
}
else {
cout<<"hello,my name is "<<name<<endl;
}
std::string name;
};
int main()
{
Person xiaoA;
xiaoA.name="xiaoA";
xiaoA.Introduction();
Person*xiaoB=new Person;
xiaoB->name="志玲";
xiaoB->Introduction();
delete xiaoB;
return 0;
}
[解决办法]
提示什么错误?
[解决办法]
intro函数少了一个花括号
[解决办法]
未知的文件尾,建议把代码对齐看,代码应该没问题