View Single Post
Old 12-03-2008   #3
Sheriff Ice
Sheriff Ice's Avatar
Last Online: 06-05-2018
Join Date: Apr 2006
Posts: 3,827
Thanks: 1,348
Thanked 2,391 Times in 1,306 Posts
Groans: 0
Groaned at 16 Times in 15 Posts
Default Re: c++ guru, urgent plz

LOL man the first one is so easy

just create two integers x , y, one char z, and put two condition( if else condition for the char inputted by the user i mean the + , -) inside the "do while" loop, each time the user enters a number the loop add it or subtract it depending on the user request by selecting the sign he wants.

similar to this

if (z== '+')
x+y= x;  

if (z== '-')
x-y = x;

if (z== '=')
cout<<"the result of ur equation is "<< x<<endl;

cout<<"you entered an invalid value, plz retry";
something similar to this

the code that i wrote should be in the do while loop

the do while loop should have a condition to exit from the loop

ya3ne declare an integer and assign a value to it if a ==1 than exit

you should know how to write such stuff

refer to the book ur studyin

PS: dont copy my code its full of mistakes, and it is just a sample not a working one, im trying to help you and give you a convention how ur program should be
__________________ Lebanese Produced Mobiles Games by
Sheriff Ice is offline   Reply With Quote
The Following User Says Thank You to Sheriff Ice For This Useful Post:
sciencedoor (12-03-2008)