新手编程出现问题,求高手指教
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int i;
int j;
double Xa,R;
double a,b;
double getx[100];
double gety[100];
cout<<"请输入Xa,R的值:";
cin>>Xa>>R;
cout<<"请输入a,b的值:";
cin>>a>>b;
for( j=0;gety[j]<=sqrt(pow(R,2)-pow(Xa,2));j++,gety[j]=b+gety[j-1])
{ for( i=0;getx[i]<=R-Xa; i++,getx[i]=a+getx[i-1])
cout<<gety[j]<<getx[i]<<endl;
return 0;
}
}
[解决办法]
你这样试试我在我的电脑上试了一下没问题
程序对了你再在你的程序上根据你想要的结果去改吧
#include <iostream>#include <cmath>using namespace std;int main(){ int i,j; double Xa,R,a,b,getx[100]={0},gety[100]={0}; cout<<"请输入Xa,R的值:"; cin>>Xa>>R; cout<<"请输入a,b的值:"; cin>>a>>b; for( j=0;gety[j]<=sqrt(pow(R,2)-pow(Xa,2));j++,gety[j]=b+gety[j-1]) { for( i=0;getx[i]<=R-Xa; i++,getx[i]=a+getx[i-1]) cout<<gety[j]<<getx[i]<<endl; return 0; } return 1;}