| | |
Don't have a clue
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
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
| Thread Tools | Search this Thread |
api array beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game getline google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text text-file tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






