Write a program that calculates how much a person earns in a month if the salary is one penny the first day and doubles each day worked. The program should ask the user for the number of days worked during the month and should display a table showing how much the salary was for each day worked, as well as the total pay earned for the month.
Input validation: Do not accept a number less than 1 or more than 31.
Here is my code so far as I am stumped on how to get the salary to double with each day. I believe you have to set something to =0*2 but not sure exactly what
The stuff in bold I have so far in the above description.
[code=cplusplus]#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main ()
{
int days;
double salary;
double const dailyPay=0.01;
cout << "How many days did you work?: ";
cin >> days;
while (days <1 || days>31)
{cout << "That is an invalid days selection, please select 1-31: ";
cin >> days;}
salary = (dailyPay * 2) * days;
cout << "\nPer day Total";
cout << "\n-----------------------------\n";
cout << "Your total salary is: " << fixed << setprecision (2) << salary;
cout << "\n";
return 0;
}