Answer» Hi everyone I would like to know how to convert Celsius to Fahrenheit in a batch file and vice vers I hope that you can help me thanksWhy do you want to use a batch file? Batch arithmetic can only use whole numbers (integers) so your conversions would not be very accurate. Anyhow, if you know the arithmetic needed, which is obvious when you think about it (Fahrenheit has 180 degrees from freezing point of water to boiling, and starts at 32, while Celsius has 100 degrees and starts at 0), you can use the SET /A COMMAND which is documented in MANY places, including at the prompt by typing SET /?. thanks I will try that...
Yup! it worked out great thanks for the help! TEMPERATURE converter scripts are found everywhere. So there is no real advantage of doing it in batch. The OP did not say why he NEEDS it in batch. Here is one in Python: http://www.pythonforbeginners.com/code-snippets-source-code/python-code-celsius-and-fahrenheit-converter The above is also a nice short introduction to Python. There is something weird about this thread.
well i came across this lesson in my C++ tutorial ( C++ for dummies 5th edition )
Code: [Select]#include<iostream>
using namespace std;
INT main()
{
float fahrenheit, celsius;
cout << "Enter the temperature in Celsius : ";
cin >> celsius;
fahrenheit = (celsius * 9.0) / 5.0 + 32;
cout << "The temperature in Celsius : " << celsius << endl;
cout << "The temperature in Fahrenheit : " << fahrenheit << endl;
return 0;
}
but this would be need to be compiled befor it is of any useOr use this: http://immigrationroad.com/life-in-us/easy-card-reference/Fahrenheit-to-Celsius-Conversion-Table.pdf Just write a batch file to show the file to the user and he can do the conversion himself using his visual abilities.
|