I got my first homework assignment for my computer science class, I am a major in financing so I appreciate any help possible.
This is what must be written.
Write a Pre-c++ program that keeps on inputting numbers until the number is zero is input, at which time the program stops. After each number (including zero) has been input, the program outpus to the screen (at the start of a new line) the words "Thnumber is ", followed by the actual number in question. After all the inputting has finished, the program outputs to the screen the word "Finished" at the start of a new line.
I have part of it started, but im a little lost.
Set up computer
Void prompt ( );
Main ()
int x;
prompt ();
while (x!=0)
[
cout<<"The number is:"<<x<<endl;
]
My problem is when the number 0 is inputted I still need to have that Statement saying "The number is:" 0 and then the finished statement after words. Is it possible to use an if statement after the while statement saying.
If (x==0)
cout<<"The number is:"<<x<<endl;
cout <<finished<<endl;
Any input is appreciate.