C++ 编程问题 在线等 时间够快 最佳

2024-11-13 04:18:22
推荐回答(1个)
回答(1):

#include

struct Point
{
float x;
float y;
};

void main()
{
Point a,b,c;
char next;
do
{
cout<<"输入a,b的坐标:格式(x y x y),不输入括号,坐标之间用空格隔开:\n";
cin>>a.x>>a.y>>b.x>>b.y;

if(a.x==b.x)cout<<"AB与Y轴无交点!\n";
else
{c.x=0;
c.y=(a.x*b.y-b.x*a.y)/(a.x-b.x);
cout<<"c点坐标为:("< }
cout<<"继续计算?(y:继续,n:不继续)";
cin>>next;
}
while(next=='y'||next=='Y');
}