all you need to do is to add another float at the beginning in which you will be adding all those gross payes. and you add a new line after line 36 and write x += grosspay
x in here is that new float i was talking about and than all you need to do is add new cout after a while loop where you will print x
and you can change line 35 to numberofemployees += 1 it will do the same thing and its better looking.
I hope it make sense to you. because my english is not the best. but if you don t understand something just ask.. i try again.
no actually your English is pretty good , thanks for replying. The only thing i did not really get is am i adding another while loop ? and if so , what is it going to be?
lets call x sum ( the new float you were talking about )
Just a word of advice - your code will be easier to read and understand if you adopt consistent indentation. This will make it easier to see how the control of it flows, and what code will be executed in which scope and under what circumstances. E.g.
ok let s call it sum. and no you don t add another while loop inside of your while loop you put sum += grosspay;
and after your while loop before system ("pause") you print out sum.. cout << sum<<endl;
and that s it.
and yeah,, you should set your sum to 0 at the beginnig when you are making your new float... float sum = 0; but I am not sure if it is necessary.