My brain has just switched off on me... have an easy program to write for a C++ class that involves a for loop with a running total, but my brain has shut down on what needs to be put into the for loop to complete the program.
The program needs to calculate how much a person would earn over a period of time (days) if his salary is one penny the first day, two the second, four the third, and continues to double each day. Program asks how many days for work, displays a table showing how much he earned each day, and how much total pay at the end of the period. Output needs to be displayed in a dollar amount, not number of pennies. There must be input validation to not accept a number less than one for days worked.
Here's where i'm at so far..
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int days;
double total = 0.0;
cout << "How many days are you working? ";
cin >> days;
while (days < 1)
{
cout << "Please enter a valid number of days to work. ";
cin >> days;
}
for (int count = 1;count <= days;count++)
{
}
return 0;
}