Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need Algorithm/ FLOWCHAT for the blow assignment ASAP. Thank you #include #include using namespace std; inline void printHeader(){ // intro cout < < endl

I need Algorithm/ FLOWCHAT for the blow assignment ASAP. Thank you

#include

#include

using namespace std;

inline void printHeader(){ // intro

cout << endl << endl;

cout << "Welcome to the Celcius/Fahrenheit Conversion Tool";

cout << endl << endl;

};

int convertCtoF (int input) // convert the users input to Farenheit

{

// variable declaration

int centigrade = input;

int fahrenheit = 0;

// formula: fahrenheit = centigrade * 9/5 + 32

fahrenheit = centigrade * 9/5 + 32;

return fahrenheit;

}

int convertFtoC (int input) // convert the users input to Celcius

{

// variable declaration

int fahrenheit = input;

int centigrade = 0;

// formula: centigrade = (fahrenheit - 32) * 5/9

centigrade = (fahrenheit - 32) * 5/9;

return centigrade;

}

char Menu()

{

char menuOption;

// display the menu options

cout << " Press \'C\' to convert Celcius to Fahrenheit," << endl;

cout << "press \'F\' to convert Fahrenheit to Celcius," << endl;

cout << "or press \'X\' to exit the program: ";

cin >> menuOption;

return menuOption;

}

int main()

{

// variable declaration

int input = 0;

int answer = 0;

char menuOption;

printHeader();

menuOption = Menu();

// main loop

while (toupper(menuOption) != 'X')

{

if (toupper(menuOption) == 'C')

{

cout << endl << "Please enter degrees Celcius to convert to Fahrenheit: ";

cin >> input;

answer = convertCtoF(input);

cout << endl << input << " degrees Celcius is equal to " << answer << " degrees Fahrenheit." << endl;

}

else if (toupper(menuOption) == 'F')

{

cout << endl << "Please enter degrees Fahrenheit to convert to Celcius: ";

cin >> input;

answer = convertFtoC(input);

cout << endl << input << " degrees Fahrenheit is equal to " << answer << " degrees Celcius." << endl;

}

else

{

cout << endl << menuOption << " is not a valid responce." << endl;

}

// redisplay the menu

menuOption = Menu();

}

cout << endl << endl;

cout << "Thank you for using the Celcius/Fahrenheit Conversion Tool." << endl;

cout << "Program terminated by user. Press any key to close this window.";

_getch();

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions