读书人

新手编程出现有关问题

发布时间: 2012-03-29 12:53:12 作者: rapoo

新手编程出现问题,求高手指教
#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;
}
}

[解决办法]
你这样试试我在我的电脑上试了一下没问题
程序对了你再在你的程序上根据你想要的结果去改吧

C/C++ code
#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;} 

读书人网 >C++

热点推荐