Heres the source code:
// Convert temperature from Celsius to Fahrenheit & vice versa
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
int main(int nNumberofArgs, char* pszArgs[])
{
using namespace std;
string choice = "y";
char CF;
char C;
char F;
cout << "Assign Celsius to a key" << endl;
cin >> C;
cout << "Assign fahrenheit to a key" << endl;
cin >> F;
cout << endl; while (choice == "y"){
cout << "Which do you wish to convert?";
cout << endl;
cin >> CF;
if (CF == C)
{
// Celsius
double celsius;
cout << "Enter the temperature in Celsius: ";
cin >> celsius;
// Factor
double factor;
factor = 180.0;
// Celsius to fahrenheit using factor
double fahrenheit;
fahrenheit = factor * celsius/100.0 + 32.0;
// Output the results on-screen
cout << "Fahrenheit value is: ";
cout << fahrenheit << endl; cout << endl;
}else
{
double Fahrenheit;
cout << "Enter the temperature in fahrenheit: ";
cin >> Fahrenheit;
cout << Celsius << endl;
double Celsius;
Celsius = (Fahrenheit - 32)*5/9;
cout << "Celsius value is: ";
cout << endl;
}
cout << "Would you like to start again?" << endl;
cin >> choice;
system("cls");
}
system("PAUSE");
return 0;
}
Click to animate
nice one i cant even use java sometime
ReplyDeletedayme son it takes a lot of coding for somthing so small
ReplyDeleteI Live in a dorm with Americans...this could come in handy :D
ReplyDelete+follow
Nice stuff man, I tried to self-teach C++ some time ago, I gave up way before this stage though.
ReplyDeleteAwesome blog, very interested in coding so followed.
wow...im a total nut for this kinda stuff, i can only admire you
ReplyDeleteI can't even program my TV.
ReplyDeleteDefinitely foreign to me, I wish I could understand it! Nice stuff, I admire you for creating this yourself! +1
ReplyDeleteDude, this is so cool! That coding looks absurdly difficult >.>.
ReplyDeleteoh cool! I really need to learn C++...
ReplyDeleteNice! Definitely better than I could do at this point.
ReplyDelete+followed
Nice.
ReplyDeleteExcept it's useless because Fahrenheit is a worthless unit. ;)
Nice as code man, I aspire to learn this stuff when I can be bothered haha
ReplyDeleteI laughed out loud at Exiro's comment. Very cool nonetheless! +1
ReplyDeleteWell, looks like my dreams of coding went out the window. What a bitch for something so simple!
ReplyDeletehaha what a trivial thing to create, but big ups anyway because youre dabbling in the black magic of this era by learning how to program ;)
ReplyDeleteThis comment has been removed by the author.
ReplyDelete@ Exiro, from a chemical engineer's perspective, Fahrenheit is much more sensible scale than Celsius. Celsius degrees encompass a much larger temperature values, while Fahrenheit allows people to be much more precise with explaining temperatures-ideal for candy-making, cooking, and scientists. Rankine is the temperature scale that, in my opinion, makes the most sense. Unfortunately, the popularity of Celsius due to the easy 0-100 water scale outweighs the inconveniences of the temperature scale.
ReplyDeleteThis all being said, Fahrenheit is just as easy when you grow up with it.
good basic coding to start! +followed
ReplyDeleteI'm a python man myself. I've been thinking about getting into C++.
ReplyDeleteI was thinking about learning Java or else,˛but when I was a young boy I used to learn a bit of C++. Sadly I don't remember anything...
ReplyDeleteWell done! I'm learning objective C, myself :)
ReplyDeletenow program something that will fill my bank account with money
ReplyDeletenot bad, did something similar myself not too long ago :)
ReplyDelete+followed
www.whatshouldibuytoday.blogspot.com
nice programming skills!
ReplyDeleteDude that's impressive!
ReplyDeleteI work with tons of engineers and can't understand any of that stuff
+followed! :D
Always wanted to learn this stuff, thanks for inspiring!
ReplyDelete