C++编译器这几句错误提示什么意思?急求在线等

C:\Users\磊\Desktop\Cpp1.cpp(23) : error C2628: 'A' followed by 'int' is illegal (did you forget a ';'?)
C:\Users\磊\Desktop\Cpp1.cpp(31) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.

第1个回答  2012-06-13
是否忘记打分号了?

最好把代码贴出来追问

#include
#include
using namespace std;
class A
{
public:
double x,y;
void get_x()
{
cout>x;
}
double put_y()
{
double sh( double x )
{ return ( exp( t )-exp( -t ) )/2; }//1

y = sh( 1+sh(x) )/( sh( 2*x )+sh( 3*x ) );
return y;

}

}
int main()

{A a;
double x;
a.get_x();
cin>>x;
a.put_y();

}

追答

class A
{
};
需要这样

int main()之前缺少};

第2个回答  2012-06-13
int后直接用A是非法的,可能你在后面少了分号。
main需要一个返回值,你是不是少写了return语句。
相似回答
大家正在搜