You will laugh when you look at it!!

I'm new in c++ . So i'm struggling to solve this question, please help me!!!

*******
Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are integers of one or two digits.

1. Read number and store it in a local variable.
2. Test if the operation failed. If it did it means that there are no more numbers and you need to terminate the program.
3. Test if the local variable equals 42, if it does, terminate the program.
4. Otherwise, print this number (the local variable) and get back to step 1.

1. Read number and store it in a local variable.
2. Test if the operation failed. If it did it means that there are no more numbers and you need to terminate the program.
3. Test if the local variable equals 42, if it does, terminate the program.
4. Otherwise, print this number (the local variable) and get back to step 1.

Please write it for me. I swear i won't post something like this here again

Please write it for me. I swear i won't post something like this here again

Just imagine what would happen if every new guy asked that! ( Many do, but most are discouraged by our steardy attitude! )
Anyway, good luck in what you're trying to do. Don't give up! Programming needs patience! ( Someone who's not so patient tells you this. )

EDIT: I can't see the fun either! Do you know why a joke is called cold? Because your lips freeze!

Just imagine what would happen if every new guy asked that! ( Many do, but most are discouraged by our steardy attitude! )
Anyway, good luck in what you're trying to do. Don't give up! Programming needs patience! ( Someone who's not so patient tells you this. )

EDIT: I can't see the fun either! Do you know why a joke is called cold? Because your lips freeze!