I don't know where to start

Hi, I im a 9th grade student and haven't been learning c++ for long .
I have to make this program below, but i don't know how to write that condition ... Can you please help ?

Read numbers until two equal numbers appear consecutively . Determine the sum of the numbers read.

Example :
Input : 5 6 2 1 1
Output : 15

Thanks !
Last edited on
You can create two variables. Then using a do-while loop to insert input two numbers in those 2 variables, and you can keep checking if the one variable is equal to the other one, if it is break the loop and print out the sum (assuming you've been putting in the user input in a variable sum)
But if they aren't consecutive, the program doesn't have to stop
Yeh, that'll be the condition of you do-while loop.
Oh, can you please show me the algorithm ? :(
I feel like calling this an algorithm is a bit too much :p Why dont you use what Ive told you so far and get started, we dont do peoples work here, we only help, get started, come back and show the code and tell us the spcific problem you've encountered if any.

And use code tags - http://www.cplusplus.com/articles/jEywvCM9/
Topic archived. No new replies allowed.