| | |
Don't have a clue
![]() |
•
•
Join Date: Dec 2008
Posts: 14
Reputation:
Solved Threads: 0
23. To convert Fahrenheit ( F ) temperatures to Centigrade ( C ) temperatures people use the formula: (32 degrees F is 0 degrees C, 212 degrees F is 100 degrees C, etc.)
double C,F;
Programmer Pauline noticed a strange problem when she tested the program: the output was always zero no matter what value was for F.
What might fix the problem?
a) C should have been int type
b) The number 32 should have been 32.0
c) The number 9 should have been 9.0
d) F should have been int type
e) 5 / 9 should have been 5 % 9
double C,F;
cin >> F; C = ( 5 / 9 ) * ( F - 32 ); cout << C;
Programmer Pauline noticed a strange problem when she tested the program: the output was always zero no matter what value was for F.
What might fix the problem?
a) C should have been int type
b) The number 32 should have been 32.0
c) The number 9 should have been 9.0
d) F should have been int type
e) 5 / 9 should have been 5 % 9
what is the value of 5/9 ? Notice that is integer math, not floating point, so all decimals are lost. Once you understand that, its simple 2nd grade math to figure out the rest of the problem.
The most important thing in the Olympic Games is not to win but to take part, just as the most important thing in life is not the triumph but the struggle. The essential thing is not to have conquered but to have fought well.
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
![]() |
Similar Threads
- Any clue for my Graduation project (Computer Science)
- i have no clue wut i did (Troubleshooting Dead Machines)
- Does anyone have a "CLUE"? (C++)
- I Have No Clue (Windows NT / 2000 / XP)
- messed up windows... again! (Windows NT / 2000 / XP)
- Help C++ Assignment - NO CLUE (C++)
- I think I have a virus (Windows NT / 2000 / XP)
- ATTN: VMWare Users (*nix Software)
- Setting up "fortune" for logins ... (*nix Software)
Other Threads in the C++ Forum
- Previous Thread: just wondering if this would output C++ alone? need second opinion
- Next Thread: pointersq
Views: 284 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
6 algorithm api array arrays assignment beginner binary c++ c++borland c/c++ calculator char class classes code compile compiler constructor conversion convert count delete dll dynamic encryption error file files filestream form forms fstream function functions game givemetehcodez graph graphics gui homework iamthwee input int integer lazy linker list loop math matrix member memory network newbie news number object objects opengl operator output parameter pointer pointers problem program programming project qt random read recursion recursive reference return search server sort spoonfeeding string strings struct student studio template templates text time tree variable vc++ vector video visual win32 window windows winsock wxwidgets






