Original Post
Ok everyone. I am COMPLETELY stumped on this problem (not a game programming problem, just a regarular ol'' programming problem).
It''s actually a math problem that I can''t figure out. And it''s a simple problem, at that! But for some reason I am having the hardest time getting the correct results with my code.
I even showed the math problem to my Mom and Dad and some other people and they couldn''t figure it out.
So here''s the problem (from the book Object-Oriented Programming In C++, Chapter Two, Excersize Ten.)
In the heyday of the British empire, Great Britain used a monetary system based on pounds, shillings, and pence. There were 20 shillings to a pound, and 12 pence to a shilling. The notation for this old system used the pound sign, and two decimal points, so that, for example, £5.2.8 meant 5 pounds, 2 shillings, and 8 pence. (Pence is the plural of penny.) The new monetary system, introduced in the 1950''s, consists of only pounds and pence, with 100 pence to a pound (like US dollars and cents). We''ll call this new system decimal pounds. Thus £5.2.8 in the old notation is £5.13 in decimal pounds (actually £5.13333333). Write a program to convert the old pounds-shillings-pence format to decimal pounds. An example of the user''s interaction would be
Enter pounds: 7
Enter shillings: 17
Enter pence: 9
Decimal pounds: £7.89
So there you have it. The question that has stumped me like a... well, a stump! I don''t exactly want somebody to code up the problem, just give me a push in the right direction. What math am I missing? I don''t get it...
And on top of that this is only from chapter two so you can''t use any type of loops or decisions in your code. The only topics that have been covered so far are c++ program structure, variables, input/output with cout and cin, arithmetic operators, assignment and increment operators, and type casts.
Please help...
Thanks in advance,
-vibaka-