Question:
Write a program that will allow a user to choose the thing below in c++ programming?
anonymous
2012-04-29 22:02:53 UTC
- to convert the temperature in Celsius to Fahrenheit
- to convert the length in centimetres to feet and inches
(Use: user-defined function , and if..else structure) . please help me to answer this question in c++ programming
Three answers:
Only Dreams Now
2012-04-29 22:05:15 UTC
Google.com
?
2016-12-01 11:06:19 UTC
first of all. And definite I say this to each and all of the individuals who heavily think of approximately utility progression in C - use C++ rather. Rumors of C being much less complicated and extra perfect are fake. C is made to have interaction with the equipment and OS very heavily, no longer for utility progression. Now to your question. in case you're actually not applying a GUI (and that i do no longer think of you're, else you does not be asking) Create a Boolean for On/Off. Then some integers to maintain song of person alternatives. additionally, make a type. while instructors say OOP is powerful, they imply it. No I won't supply you a pre made code, through fact which you may desire to have the flexibility to do it on your very own (rly, no longer that puzzling) and its a reliable possibility so you might verify approximately I/O, documents and OOP. in basic terms a word, use getline(cin, std::string) rather then cin.operator>>(std::string). the 1st one is extra useful for a load of motives, one in each of them is that the person might desire to truly enter "wash clothing" rather of 'W'.
The Shadowman
2012-04-29 22:21:16 UTC
First, write your code than come back and we'll help you with any errors. If you want an algorithm to kick start, than I'll happy to give it to you. I'll assume that you already know the formula to convert C to F and centimeters to feet and inches.



declare prototypes of user define functions

declare a convert function that convert C to F

declare a centToFeet function to convert centimeters to feet

declare a centToInches function to convert centimeters to inches

main()

declare variable Celsius as 0

declare variable fahrenheit

declare variable length as 0

declare variable feet

declare variable inches

set fahrenheit equals to convert function

-pass the variable celsius as a parameter

-display the fahrenheit

set feet equals to centToFeet function

-pass the variable length as a parameter

-display the feet

set inches equals to centToInches function

-pass the variable length as a paremeter

-display the inches



convert function()

declare variable for fahrenheit

ask user to enter in celcius using the variable that was passed in the parameter

prompt any message if invalid input is entered

if input is valid

-do calculations

-return fahrenheit



centToFeet function()

declare variable for feet

ask user to enter in length using the variable that was passed in the parameter

prompt any message if invalid input is entered

if input is valid

-do calculations

-return feet



centToInches function()

declare variable for inches

ask user to enter in length using the variable that was passed in the parameter

prompt any message if invalid input is entered

if input is valid

-do calculations

-return inches


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...