FloatingPoint,
Your difficulty seems to be with the "word problem" aspect of this problem. Computer programs usually start with a problem statement or task in words.
Just like math "word problems", much of the work is in determining what the problem really is and how to solve it. You may not need to know a particular programming language to do this part.
The second part of the problem is how to write the C++ code... knowing what library functions and language features are avallable, what they do and how to use them, and the general language syntax.
For a problem like this, you need to figure-out to do it with a calculator before writing a program. Of course, if you do get something wrong in your algorithm or program flow, you can debug it later.
You should plan your program before you start it. You can use a flow chart, psuedo code, outline, etc. I usually take an outline approach with a bunch of comments... not quite as detailed as real psuedo code.
Before I write any code, I usually something like this:
Code:
int main()
{
// SET-UP CONSTANTS (percent sweetner)
// SET-UP (declare) VARIABLES
// Amount of sweetner that kills mouse
// Amount of sweetner that kills dieter
// Mouse Weight
// Dieter Weight
// NOTE: Dieter weight not really needed. could just put
// the calculation in the cout statement.
// GET USER INPUT
// Amount of Sweetner that kills mouse
// Mouse Weight
// Dieter Weight
// MAKE CALCULATIONS
// DISPLAY RESULTS (amount of sweetner that kills dieter)
return 0;
}
Next, I'd add the calculations to the outline
Code:
//...
// MAKE CALCULATIONS
// Find ratio of (sweetner that kills mouse) to (mouse weight)
// Multiply ratio by dieter's weight
// NOTE: If this is done in two steps, we will need a "ratio" variable.
//...
After I had the program planned-out, I'd add a few lines of real code and then test-compile.... Add a few more lines of code and re-compile. I'd test-run the program as soon as there was a cout statement. (I would make a cout statement before I wrote the calculation part of the program.)