Posted: 2/24/2005 6:22:52 PM EDT
I'm trying to write a program that shows the salary a person would make, if on the first day he made $.01 (one cent), second day - $.02, third day $.04, and doubled every day thereafter. The user will input the number of days to be calculated. The program will then display in a table form the pay for every day, and then show the total of all the days work. Output should look like:Please enter the number of days worked: 6 The problem I'm having is figuring out how to keep a running total within the while loop. Here's my code so far: #include <iostream> |
I don't see where your total variable is updated. Try something like this :
Good luck! |