You
call (or
invoke) a function by way of assignment:
Right?
You
select (or
switch) between actions using a switch statement:
1 2 3 4 5
|
switch (tavaizvele) {
case 1: cout << "I should compute and print meters here\n"; break;
case 2: cout << "I should compute and print decimeters here\n"; break;
case 3: cout << "I should compute and print millimeters here\n"; break;
}
|
A
function prototype looks like these:
1 2
|
double M( double, double );
double Q();
|
Neither actually calls any function. It is just informative to the compiler. (And should be flagged as an error by the compiler when found inside other functions.)
In order to help you find the problems, make sure to turn the warnings
all the way up on your compiler. If you are using the command-line:
MSVC:
cl /EHsc /W4 /std:c++17 ...
GCC:
g++ -Wall -Wextra -pedantic-errors -std=c++17 ...
Clang:
clang++ -Wall -Wextra -pedantic-errors -std=c++17 ...
(Use a later version of the standard if you wish, but you should be using at
minimum C++17.)
If you are using an IDE go to the compiler setup and make sure that the warnings are set to the highest level. You will likely see something similar to the command-line stuff above that will help you select it.
Remember, you must combine
switch
with the stuff that actually does things.
Good luck!