关于记数 问题
我想知道知道为什么sum的值还是0,请高手知道并解决难题,谢谢#include<iostream.h>
#include<math.h>
#define Pi 3.1415926
class point
{
public:
double x0;
double y0;
point()
{
}
void disp()
{
}
};
class circle:public point
{
public:
double x1;
double y1;
double r;
int sum;
int count;
double s;
circle()
{
cout<<"请输入一个横坐标:";cin>>x0;
cout<<"请输入一个纵坐标:";cin>>y0;
cout<<"请输入园的横坐标:";cin>>x1;
cout<<"请输入园的纵坐标:";cin>>y1;
cout<<"请输入半径:";cin>>r;
}
void disp()
{
sum=0;count=0;
s=sqrt((x0-x1)*(y0-y1)+(x0-x1)*(y0-y1));
cout<<"\t坐标:("<<x0<<","<<y0<<")";
cout<<"\t园坐标:("<<x1<<","<<y1<<")";
cout<<"\t面积:"<<Pi*r*r;
if(r>s)
{
cout<<"\t距离是"<<s;cout<<endl;
cout<<"\t点在圆心内"<<endl;
sum++;
}
else
{
cout<<"\t距离是0";cout<<endl;
cout<<"\t点不在圆心内"<<endl;
}
}
friend bool puanduan(circle r,circle s)
{
}
};
void main()
{
char flag;
int count=0;
int sum=0;
do
{
point p;
circle c;
p.disp();
c.disp();
count++;
cout<<"继续判断?";cin>>flag;
}while(flag!='n');
cout<<"判断了"<<count<<"次"<<"包含"<<sum<<"次."<<endl;
}