#include <cstdlib>
#include <iostream>
usingnamespace std;
int main(int argc, char *argv[])
{
double CENT=1;
int days=0;
int counter=0;
double total=0;
cout<<"How many days are you working?:"<<endl;
cin>>days;
for(counter = 1 ; counter <= days;counter++)
{
/* Here is the problem I dont know how to do the math so I can get this to work ...
*/
total=(counter* CENT*2 );
//I get this part to work..
cout <<"On day "<<counter<<" you recive:"<<" $ "<<total<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
for(counter = 1 ; counter <= days ; counter++)
{
total = CENT;
CENT = CENT*2;
cout << "On day "<<counter<<" you receive:"<<" $ "<<total<<endl;
}
On day 1 you receive: $ 1
On day 2 you receive: $ 2
On day 3 you receive: $ 4
On day 4 you receive: $ 8
On day 5 you receive: $ 16
On day 6 you receive: $ 32
Basically you just set the value of CENT to total then double CENT. This should work just fine.