I'm a newb to c++ and I don't want to start off with bad practices (I came from vb). Heres a little temp. conversion program I made. Tell me what you think.
Anything look bad here? I know about the truncated integer variable. I figure this is for temperature conversion so I don't need the precision. I also received this warning from the compiler:Code:#include <iostream> int selection; int number; int ftoc(int number) { return((number-32)*(1.8)); } int ctof(int number) { return((1.8*number)+32); } int main() { std::cout << "Welcome to the Fahrenheit/Celsius Conversion Utility! \n"; std::cout << "Please choose a number: \n"; std::cout << " [1] Fahrenheit to Celsius\n"; std::cout << " [2] Celsius to Fahrenheit\n"; std::cin >> selection; std::cout << "Please enter the number to be converted: \n"; std::cin >> number; switch(selection) { case 1: std::cout << "Result: " << ftoc(number) << "\n"; break; case 2: std::cout << "Result: " << ctof(number) << "\n"; break; default: std::cout << "Please choose either 1 or 2.\n"; break; } return 0; }
"warning: no new line at end of file"
Any idea what this means?
Thanks.




Reply With Quote