i need to make this program be able to accept input on whether you wanna enter Fahrenheit, kelvin, or Celsius and then it will display the other options depending on what you input this is a practice i gave my self but i can't figure it out. Link to pastebin: https://pastebin.com/39pCrdi9
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <limits>
usingnamespace std;
double f;
double c;
double k;
double result;
int main()
{
cout << "Pick a temperature unit K for Kelvin, F for Fahrenheit, C for Celsius: ";
cin >> result;
cout << endl;
if(result == 'f' || result == 'F')
{
cout << "This program will tell you what the degrees where you live is in Kelvin and Celsius." << endl;
cout << endl;
cout << "What's your temperature in Fahrenheit: ";
while(!(cin >> f)){
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
cout << "Invalid temperature try again. ";
cout << endl;
cout << "What's your temperature in Fahrenheit: ";
}
cout << endl;
k = c + 273.15;
cout << "Your degrees in Kelvin is: " << setprecision(3) << k << " Kelvin" << endl;
cout << endl;
c = (f - 32) * 5 / 9;
cout << "Your degrees in Celsius is: " << setprecision(2) << c << "Celsius" << endl;
cout << endl;
}
if(result == 'c' || result == 'C')
{
cout << "This program will tell you what the degrees where you live is in Kelvin and Fahrenheit." << endl;
cout << endl;
cout << "What's your temperature in Celsius: ";
while(!(cin >> c)){
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
cout << "Invalid temperature try again. ";
cout << endl;
cout << "What's your temperature in Celsius: ";
}
cout << endl;
k = c + 273.15;
cout << "Your degrees in Kelvin is: " << setprecision(3) << k << " Kelvin" << endl;
cout << endl;
(f = (c × 9/5) + 32);
cout << "Your degrees in Fahrenheit is: " << setprecision(2) << f << "Fahrenheit" << endl;
cout << endl;
}
if(result == 'k' || result == 'K')
{
cout << "This program will tell you what the degrees where you live is in Fahrenheit and Celsius." << endl;
cout << endl;
cout << "What's your temperature in Kelvin: ";
while(!(cin >> k)){
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
cout << "Invalid temperature try again. ";
cout << endl;
cout << "What's your temperature in Kelvin: ";
}
cout << endl;
f = (k − 273.15) × 9/5 + 32;
cout << "Your degrees in Fahrenheit is: " << setprecision(2) << f << "Fahrenheit" << endl;
cout << endl;
c = (f - 32) * 5 / 9;
cout << "Your degrees in Celsius is: " << setprecision(2) << c << "Celsius" << endl;
cout << endl;
}
if (f <= 65)
{
cout << "It must be chilling outside don't forget a coat." << endl;
}
if (f >= 75)
{
cout << "It's pretty warm out no need for a coat." << endl;
}
if (f > 65 && f < 75)
{
cout << "It's a little cold but you should need a coat hopefully" << endl;
}
return 0;
}