Cześć. Jest dosyć nowe zadanie na spoju mianowicie f(x)=ax+b. https://pl.spoj.com/problems/DDZ1/
Dlaczego wyświetla błędną odpowiedź?
#include <iostream>
using namespace std;
int main(){
int a, b;
while(cin>>a>>b){
if(a==0){
cout<<"f(x)="<<b<<endl;
}
else if(b>0){
cout<<"f(x)="<<a<<"x+"<<b<<endl;
}
else{
cout<<"f(x)="<<a<<"x"<<b<<endl;
}
}
return 0;
}