|
|
вернуться в форумwhere is the problem? thank you #include <iostream> using namespace std; int main(int argc, char* argv[]) { int a,b; cout<<"please input integer a and b:"; cin>>a>>b; if( cin.fail() ) { cin.clear(); cin.sync(); cout<<"input error"<<endl; return -1; } int result = a + b; if( a > 0 && b > 0 ) { if( result < 0 ) cout<<"overflow"<<endl; } else if( a < 0 && b < 0 ) { if( result > 0 ) cout<<"overflow"<<endl; } cout<<result<<endl; return 0; } how can I get more wrong information? Re: where is the problem? thank you Послано Dusan 1 июн 2008 20:51 #include <iostream> using namespace std; int main(int argc, char* argv[]) { int a,b; cin>>a>>b; cout<<a+b; return 0; } you don't need to write mesages like .....cout<<"please input integer a and b:";.......your output must be only A+B |
|
|