
pennies for pay
I am currently taking c++ and using the Tony Gaddis book for my instruction.
In this book there is a program that i am having a hard time with. It ask
a user to input how many days he has worked and he is payed a penny a day
and doubles every day that he work's. 1st day 1 cent 2nd day 2cents 3rd day
4 cents etc....
and then askes for a total amount payed for the number of days worked.It
also askes for a list of each day and the amount of pay for that day.Any
help would be greatly appreciated.

Re: pennies for pay
if u want output in dollars divide by 100.
have fun!
#include<iostream.h>
void main()
{
const int size = 50;
int days[size] = {0};
int input;
int cents = 1;
int total =0;
cout<<"\nenter number of days worked: ";
cin>>input;
cin.get();
for(int x = 0; x < input; x++)
{
days[x] = cents;
total += days[x];
cents *= 2;
}
cout<<"\ntotal pay is :"<<total<<" cents";
for(x = 0; x < input; x++)
cout<<"\nday "<<x+1<<" = "<<days[x]<<" cents";
}
"galen smith" <gsmith@doc.com> wrote:
>
>I am currently taking c++ and using the Tony Gaddis book for my instruction.
>In this book there is a program that i am having a hard time with. It ask
>a user to input how many days he has worked and he is payed a penny a day
>and doubles every day that he work's. 1st day 1 cent 2nd day 2cents 3rd
day
>4 cents etc....
>and then askes for a total amount payed for the number of days worked.It
>also askes for a list of each day and the amount of pay for that day.Any
>help would be greatly appreciated.