12-03-2008
|
#5
|
|
Last Online: 12-20-2021
Join Date: Mar 2006
Posts: 6,245
Thanks: 2,121
Thanked 3,365 Times in 1,740 Posts
Groans: 29
Groaned at 44 Times in 35 Posts
|
Re: c++ guru, urgent plz
Code:
int x, y;
char z;
cin >> x;
while(1){
cin >> z;
if(z != '+' && z != '-')
break;
cin >> y;
if(z == '+')
x+=y;
else if(z == '-')
x-=y;
}
if(z != '=')
cout << "Syntax Error" << endl;
else
cout << "The Result Is: " << x << endl;
This Should Do The Work.
__________________
What we do in life, echoes in eternity.
|
|
|