Functions are used to help out main. By helping out it makes main's code much shorter and the code becomes more readable. Functions need to actually accomplish something for them to be useful though. (Otherwise why would anyone program them to begin with?!) There are two types of basic functions in c++: those that return something and those that return nothing. For example in your program the overview function doesn't return anything to main, that is why it has the void type. However the other functions all have return values and would probably used in calculations in main. Line 15 and 16 are a good example of not using functions that return values properly.
1 2
|
getDegree ();
getScale();
|
Some more useful code might look like:
1 2
|
int degree = getDegree(); //creates an integer variable named degree and assigns the value returned from getDegree()
char scale = getScale(); //creates a character variable named scale and assigns the value returned from getDegree()
|
Lines 18, 20, 22, 24, and 77 have errors on them.
Lines 18 and 22: The variables referenced on these lines haven't been declared. (The suggestion I made above for lines 15 and 16 will fix this problem also.)
Lines 20 and 24: Here the conversion functions both expect a float variable to be passed to them. To pass a variable just put the name of it inside the parentheses (hint:
convertCtoF(degree);
or
convertFtoC(degree);
)
On line 77: the curly brace is just on the wrong line that's all.
Also on lines 17 and 28 the curly braces aren't really necessary.
Hope I helped let us know if you have more questions about functions. Also you might want to check out the reference page here:
http://cplusplus.com/doc/tutorial/functions/