here it goes..
example prog. output:

Input a number/s, (-) to stop:
5+6-7+8-9+1-2-1


-the user will input numbers, if he/she inputs a (-) number that will be the time that the program will stop.
-the operations between the numbers should be + and - (alternate).

how will i do the codes in C++?
*urgent:D

Recommended Answers

All 3 Replies

You dont seem to show us any effort. But maybe I can give you a clue. Read in numbers and if the number is less than 0 then quit..

Take a look at how the getche() function works.

here it goes..
example prog. output:

Input a number/s, (-) to stop:
5+6-7+8-9+1-2-1


-the user will input numbers, if he/she inputs a (-) number that will be the time that the program will stop.
-the operations between the numbers should be + and - (alternate).

how will i do the codes in C++?
*urgent:D

Hi!
Is this your homework? If so do it yourself.

Any way you may use a while loop and check condition for -ve number. The loop breaks when -ve no. is entered.
If you post your code it will be better for us to help you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.