The tempera trun to the Huashi C:
#include "iostream"
using namespace Std;
Class Tempera
{
Public
float cels;
Float Change ()
{
Return (9*cels)/5+32;
}
};
void Main ()
{
Tempera C;
cout << "Enter Celsius temperature value:" <<endl;
CIN >>c.cels;
cout << "Convert to Fahrenheit temperature:" << c.change () << "degrees" <<endl;
.........................................................................................................................
I used the "g++ to build", it always says "main must retrun int".
bd@bd-desktop:~/documents$ g++-O tempera tempera.cpp
Tempera.cpp:17:error: ':: Main ' must return ' int '
bd@bd-desktop:~/documents$
It should be ' int main () ' instead of ' void main (void) and then put a ' return 0 ' at the ' end of the ' function.
It's not a program problem, it's a compiler problem.
This is the standard of C language, and Dev C + + strictly comply with this rule.
The DOS version of Turbo C 3 does not conform to the language standard, and it does not mean that it is correct.
(Note: The main front must be int, since main is preceded by an int so the main function must have a return statement)