0
Please is there anyone who can guide me on how to write a code to convert Fahrenheit to Celsius and Celsius to Fahrenheit. C++
the program most accept user multiple choices. C++
5 Antworten
+ 3
The point is that you should try it on your own. There is a very simple mathematical formula that can do the conversion. You can find it e.g. on wikipedia.
And there are actually dozens of programs published on the code playground in all languages, that solve this problem.
First thing everyone need to learn as a programmer, how to search and research for information.
+ 2
Why don't you post a link to your code here so we can check what you've done?
+ 1
here is what i have done.
#include <iostream>
using namespace std;
int main()
{ float fahrenheit, celsius, num;
cout << "enter the degree amount";
cin >> num;
char operation;
cout << "Enter the preferable conversion choice"<<endl<<"1 to convert from Fahrenheit to Celsius or"<<endl<<"2 to convert from Celsius to Fahrenheit"<<endl;
cin >> operation;
switch (operation)
{
case '1':
fahrenheit = (-32)*5/9;
cout<< "the amount of degree celsius is "<<endl<<fahrenheit;
break;
case '2':
celsius = (9/5)+32;
cout<<"the amount of degree fahrenheit is"<<endl<<celsius;
break;
}
0
Yes I have done something on my own, the problem is that I can't know how to link the choice for the user like.
Type 1. To convert Fahrenheit to Celsius or 2. To convert Celsius to Fahrenheit.