Code:
#include <iostream>
using namespace std;
//declaring and defining at the same time
void print_out (int n)
{
int i;
for(i = 1; i <= n; i++)
cout<< i << endl;
}
//a prototype
int mymax(int first, int second); //note that int mymax(); would be an error
//it would designate a different function with no arguments
//so C++ would think you had two functions with the same name
//you're allowed to do that if they have different parameter lists
int main()
{
int n;
cout<< "Enter a number: ";
cin>> n;
print_out(n);
return 0;
}
//Here's the function promised earlier
int mymax(int first, int second) {
if (first > second) {
return first;
} else {
return second;
}
}