I am using Code::Blocks with GNU GCC Compiler. My first question is why do i use void here instead of int. i used int and it worked but the tutorial i am using suggested i use void. Can somone explain to me what the operator void does 0_0.
cout << "Enter a number: ";
cin >> x;
void WriteAnswer(int x)
cout << "The answer is " << x << endl;
int x = ReadNumber();
int y = ReadNumber();
I think you are speaking about function WriteAnswer. There is nothing useful to return from the function. So it is defined as having return type void that is it returns nothing.
In the main you see that you are simply calling this function to print the value of expression x + y.
What would be the sense if it would return something? The author of the function decided that its task is only to output the result and nothing more.