c++改错43

来源:百度知道 编辑:UC知道 时间:2024/06/28 15:05:39
43.#include<iostream.h>
class f{
private:int x=0,y=0;
public:void f1(int a,int b){x=a;y=b;}
void get( ){cout<<x<<’<<y<<endl;}
};
main( ){
f a;
a.f1(1,3);
a.get ( );
}

#include<iostream.h> //少了using namespace std;
class f{
private:int x=0,y=0; //此处不可赋初值
public:void f1(int a,int b){x=a;y=b;}
void get( ){cout<<x<<’<<y<<endl;} //此处<<’<<错误
};
main( ){ //main()应变为void main()
f a;
a.f1(1,3);
a.get ( );
}