One is to write program to read a collection of employee data (hours and rate) entered at the terminal and to calculate and display the gross pay for each employee. The program should stop when the user enters a sentinel value of -0 for hours.
I just wanted help as to where I should start with this, because I'm utterly lost.
Thanks
That looks reasonable. I would think it better to use type double rather than int as the hours might perhaps have a 0.5 and the hourly rate I'd expect might also have a decimal part.
Of course it needs the usual #include headers and function main()
A minor point, there are braces { } around the if-else which don't seem to serve any purpose, I would remove them.
When you have the above working to your satisfaction, you could wrap the statements from the first cout to the last cout inside a loop.
Maybe something like this:
1 2 3 4
while (true)
{
// your code here
}
Now that loop will repeat forever. So you need some way to escape from the loop. After getting the value of rate from the user, insert a couple of lines like this: