loop question

I feel like ive failed miserably by asking this, but i cant seem to get my head around my 2 problems.


First problem.
The user need to be able to write in(cin) the price for x amount of things and then get the sum of those. Im unsure where to begin here.

Second Problem.
I have a base value of 100, the value doubles each month and goes up to max 1000000(one million). How many times have i doubled when it reaches 1 million?

Ive studied if, while, for etc but i cant get my head around how to make those programs :(
Last edited on
It helps to visualize how you'd solve these problems manually in your head, then convert that process to C++ code.

Bigger problems seem overwhelming when you think of them as a whole -- but if you break it up into smaller steps it gets much simpler.

For example... let's take a look at the first problem. If someone asked you to ask Bob for X amount of things and then sum all the prices (read: not write a program to do it -- I mean actually do it yourself). What would the steps involved in that be?

Write an outline that has a simple step-by-step process of how you'd go about it. Then take each of those steps and write it in code.

Obviously, the first step of the first problem would be to get X from the user. So then what would the next step be?
Topic archived. No new replies allowed.