I am writing a program for class were the user earns 1 for the first day of work and 2 pennies on the second and 4 pennies on the 3 day doubling every day after that. My problem is, is that I can't figure out how to make the program double i tried using the pow function but that did work. Help please.
I am not understanding where it should be placed. Everywhere I have tried to add it or replace something with it I get errors. And no matter where i try it i get this error 1 IntelliSense: operand of '*' must be a pointer.
it has to display only that days pay like on day 1 it will say 1 on day 2 the pay is 2 on day three the pay 4 and the pay doubles each day. But you have to display each days pay. it counts my days. My problem is in squaring the pennies each day but if you square 1 the answer is 1 I can't get it to double it for each day. Nothing I am trying is working.
I've a feeling you're missing something very straightforward here. The idea of squaring a number is pretty much off-topic and not needed here. Instead of squaring 1
1 * 1 = 1
just multiply 1 by 2
1 * 2 = 2
on the next day, multiply the previous value by 2
2 * 2 = 4
and the day after that, multiply the previous value by 2
4 * 2 = 8
and the day after that, ...
When I use the pow function it always starts with 2 I need the pay to start with 1. then 2,4,8.....
I have tried to plug it in different ways and have even changed it around changed numbers tried to set pennies equal to one( when I do all days keep one. i still have no clue as to how to make this work.
Forget the power function completely. It does not need to be used in this program.
Now, think of it in the real world.
1. First day, you start with one.
2. Second day, the one you have doubles into 2 (you multiplied your current pay by two
3. Third day, the two doubles (you multiplied your current pay by two)
4. Fourth day, the four doubles (you multiplied your current pay by two)
Sense a pattern?
*cough* You multiply your current pay by two each time *cough*
Now, fit this in a for loop and output it each time and you are done.