1 Draw a complete and neat flowchart that converts the tempe

(1) Draw a complete and neat flowchart that converts the temperature in °C to °F or temperature in °F to °C. The user is prompted to enter the choice of conversion (for example, enter 1 for Celcius; 2 for Farenheit) and prompted to enter the temperature value. Display the original temperature value and the converted temperature value. Note: Celcius = 5 * ( F - 32 ) / 9. (2) Write a complete C++ program according to your flowchart developed in (1).

Solution

Executable code:

#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <stdlib.h>   
#include <math.h>

using namespace std;


int main()
{
double celsius;
double fahrenheit;
int choice;
double temperature;

cout << \"1.Fahrenheit to Celsius\ 2.Celsius to Fahrenheit\ Enter your choice: \";
cin >> choice;

cout << \"Enter temperature: \";
cin >> temperature;

if(choice == 1)
{
fahrenheit = temperature;
cout << \"Temperature in fahrenheit: \" << fahrenheit << endl;
celsius = (5*(fahrenheit-32.0))/9;
cout << \"Temperature in celsius: \" << celsius << endl;
}

else if (choice == 2)
{
celsius = temperature;
cout << \"Temperature in celsius: \" << celsius << endl;
fahrenheit = (celsius * 9.0) / 5.0 + 32;
cout << \"Temperature in fahrenheit: \" << fahrenheit << endl;
}

else
cout << \"Invalid Input\ \";

return 0;
}

/*
output:

1.Fahrenheit to Celsius
2.Celsius to Fahrenheit
Enter your choice: 2
Enter temperature: 100
Temperature in celsius: 100
Temperature in fahrenheit: 212


1.Fahrenheit to Celsius
2.Celsius to Fahrenheit
Enter your choice: 1
Enter temperature: 100
Temperature in fahrenheit: 100
Temperature in celsius: 37.7778


*/

(1) Draw a complete and neat flowchart that converts the temperature in °C to °F or temperature in °F to °C. The user is prompted to enter the choice of convers
(1) Draw a complete and neat flowchart that converts the temperature in °C to °F or temperature in °F to °C. The user is prompted to enter the choice of convers

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site