Ok so I coded the following:
Code:
#include <iostream>
using namespace std;
int main()
{
int days, endday, pounds;
cout << "Please enter in the amount of pounds: ";
cin >> pounds;
cout << "Please enter in the days: ";
cin >> days;
cout << "Please enter the last day you want to do this calcuation: ";
cin >> endday;
int numbers=pounds;
for(int i=days;i<=endday;i=i+days)
{
if (days==i)
pounds=pounds;
else
{
pounds=pounds+(numbers/2);
numbers=pounds;
}
cout << "The day is " << i << " and the pounds are " << pounds << endl;
}
}
But I dont get the right values for "pounds"
For instance I get :
Please enter in the amount of pounds: 10
Please enter in the days: 5
Please enter the last day you want to do this calcuation: 25
The day is 5 and the pounds are 10
The day is 10 and the pounds are 15
The day is 15 and the pounds are 22
The day is 20 and the pounds are 33
The day is 25 and the pounds are 49
Press any key to continue
what I need is day 10 to be 20, day 15, 30, day 20 to be 50 etc
Thanks for any help!