Can anyone see what I'm doing wrong?

...
Last edited on
You're multiplying too early.

1
2
3
4
5
6
7
8
// You start at $0.01, which is correct:
double Payment = .01;

// Then in your loop:
cout << Min_Number << "\t\t\t$" << (Payment *= 2) << endl;  // <- you double it before you print it
Total += Payment; // <- and before you add it to the total.

// So ultimately the first number you are printing/summing is $0.02 
Ahhh! It never occurred to me that I could put the multiplication at the end as it's own line! Order is paramount! I fixed it though. This is how that portion ended up looking:

1
2
3
4
5
6
	for (Min_Number = 1; Min_Number <= Days_Worked; Min_Number++)
	{
		cout << Min_Number << "\t\t\t$" << Payment << endl;
		Total += Payment;
		(Payment *= 2);
	}


Thanks for your help Disch!
Topic archived. No new replies allowed.