Hi, This question is related to the below.
http://www.daniweb.com/software-development/cpp/threads/352685/error-c3861-menu-identifier-not-found
I used that to solve my issue. What I would like to understand is why the function prototype is to be declared before the main function? In my textbook that I am following the function prototype wasn't there. I did as written in that thread and my error got resolved.
As the program gets complex, it would be a bunch of prototypes on top. Any way to get around this? Am I doing something wrong?
Here's my code:
// My first C++ app
#include <iostream>
using namespace std;
void print(int i); // Why? This wasn't there on textbook and on this site I'm referring
int main()
{
int marks = 0;
cout << "Enter a number\n";
cin >> marks;
print(marks);
return 0;
}
void print(int i)
{
int y = i;
cout << "You entered " << y << endl;
}