菜鸟,C++遇到问题,希望大家帮忙找一下错误……
#include<iostream>
#include<string>
using namespace std;
class three_eight_one
{
public:
string result_string,input_string;
int b;
three_eight_one(){};
void program1()
{
b=0;
while(b==0)
{
cout<<"请输入数组"<<endl;
cin>>input_string;
result_string+=input_string;
cout<<"最终数组为:"<<endl<<result_string<<endl;
cout<<"是否继续输入数组:0、输入 1、不输入"<<endl;
cin>>b;
}
}
}
int main()
{
int sel;
three_eight_one teo;
cout<<"请选择方法:0、8.3.1 "<<endl;
cin>>sel;
if(sel==0)
{
teo.program1();
}
return 0;
}
编译的时候提示错误
1> main.cpp
1>c:\users\gao\documents\visual studio 2010\projects\3.8.1\3.8.1\main.cpp(31): error C2628: “three_eight_one”后面接“int”是非法的(是否忘记了“;”?)
1>c:\users\gao\documents\visual studio 2010\projects\3.8.1\3.8.1\main.cpp(32): error C3874: “main”的返回类型应为“int”而非“three_eight_one”
1>c:\users\gao\documents\visual studio 2010\projects\3.8.1\3.8.1\main.cpp(42): error C2664: “three_eight_one::three_eight_one(const three_eight_one &)”: 不能将参数 1 从“int”转换为“const three_eight_one &”
1> 原因如下: 无法从“int”转换为“const three_eight_one”
1> 无构造函数可以接受源类型,或构造函数重载决策不明确
1> 3_8_1.cpp
1>c:\users\gao\documents\visual studio 2010\projects\3.8.1\3.8.1\3_8_1.cpp(1): fatal error C1083: 无法打开包括文件:“header.h”: No such file or directory
1> 正在生成代码...
1>
1>生成失败。
1>
1>已用时间 00:00:02.58
希望大家帮助一下拉 感谢!!