![]() |
|
#1
|
|||
|
|||
Creating options and menusI'm trying to create a program that will, when you launch it, ask you if you either want to convert the temperature from Fahrenheit to Celsius or Celsius to Fahrenheit. I think im on the right track but the program closes when I put in the temperatrue. For some reason it doesnt get the the part of the code that shows the result.
CPP / C++ / C Code:
__________________
*****Disclaimer***** I am in no way a professional programmer nor do I play one on T.V. |
|
#2
|
|||
|
|||
|
why these lines are in braces? Did you try removing the braces arround them and check?
CPP / C++ / C Code:
Also, use following structure for if loop CPP / C++ / C Code:
Or better yet, use "switch" CPP / C++ / C Code:
|
|
#3
|
|||
|
|||
|
Quote:
correct switch structure is: CPP / C++ / C Code:
CPP / C++ / C Code:
|
|
#4
|
|||
|
|||
|
sorry...
|
|
#5
|
||||
|
||||
|
Please read the tutorial on formatting. Bad formatting is sometimes worse than no formatting.
And forget switch. The if works just fine for now. Output your values as soon as you enter them to make sure they are being read properly. __________________
Age is unimportant -- except in cheese |
|
#6
|
|||
|
|||
|
Ok, I reformated the code and added a line to read back the input choice but my origional problem still remains. Why is the program ending before it reads back the conversion? Here is the code.
CPP / C++ / C Code:
__________________
*****Disclaimer***** I am in no way a professional programmer nor do I play one on T.V. |
|
#7
|
|||
|
|||
|
#8
|
|||
|
|||
|
For F to C conversion you are calling function Convert() same as for C to F.
Shouldn't you be calling Change() for F to C ? I tried it on my machine, it seems to be working fine. Quote:
|
|
#9
|
||||
|
||||
|
Just a suggestion, its better to have a single return in main or any function.. CPP / C++ / C Code:
__________________
"True knowledge is knowing that you know nothing." |
|
#10
|
|||
|
|||
|
where do I put cin.get?
__________________
*****Disclaimer***** I am in no way a professional programmer nor do I play one on T.V. |
Recent GIDBlog
More photos on Flickr by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The