#15286: 請問錯在哪裡?


talexy (talexy)


#include <iostream>
using namespace std;

int main(){
int a,b,c,d,t,e=1,f;
cin>>t;
while(t>=e)
{
cin>>a,b,c,d;
if(b-a==c-b)
{
f=d+(b-a);
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<f<<endl;
}
else
{
f=d*(b/a);
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<f<<endl;
}
++e;
}
return 0;
}

#15360: Re:請問錯在哪裡?


u610632@tcivs.tc.edu.tw (中工一朵花)


#include
using namespace std;

int main(){
int a,b,c,d,t,e=1,f;
cin>>t;
while(t>=e)
{
cin>>a,b,c,d;
if(b-a==c-b)
{
f=d+(b-a);
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<f<<endl;
}
else
{
f=d*(b/a);
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<f<<endl;
}
++e;
}
return 0;
}

cin格式錯誤


應更正為  cin>>a>>b>>c>>d;