#include<iostream>
using namespace std;
class Point
{
private:
double x, y;
public:
Point ( ) { };
Point(double a, double b)
{x=a; y=b;}
void Setxy(double a, double b)
{x=a; y=b;}
void Display()
{cout<<x<<"\t"<<y<<endl;}
};
void main()
{
Point a;
Point b(18.5 , 10.6);
a.Setxy(10.6 , 18.5);
a.Display();
b.Display();
}
using namespace std;
class Point
{
private:
double x, y;
public:
Point ( ) { };
Point(double a, double b)
{x=a; y=b;}
void Setxy(double a, double b)
{x=a; y=b;}
void Display()
{cout<<x<<"\t"<<y<<endl;}
};
void main()
{
Point a;
Point b(18.5 , 10.6);
a.Setxy(10.6 , 18.5);
a.Display();
b.Display();
}
1、双箭头<<或>>之间不能有空格;
2、main函数返回值应该为int,void不行,你可以在后面加一个return 0(不加也行)。