I am really a newbie to C++ and I've been reading the Sams Teach Yourself C++ in 21 Days book. There is one example program in the book demonstrating the use of function prototypes, and I've typed in the code exactly as it is in the book, but I got some errors. Firstly I got a syntax error before numeric constant in line 28, the one with the function definition. Then, I got another error " 'w' undeclared (first use this function) in line 30. Anyone can tell me what is wrong?
Code:// Listing 5.1 - demonstrates the use of funtion prototypes #include <iostream> int Area(int length, int width); //function prototype int main() { using std::cout; using std::cin; int lengthOfYard; int widthOfYard; int areaOfYard; cout << "\nHow wide is your yard? "; cin >> widthOfYard; cout << "\nHow long is your yard? "; cin >> lengthOfYard; areaOfYard = Area(lengthOfYard, widthOfYard); cout << "\nYour yard is "; cout << areaOfYard; cout << " square feet\n\n"; return 0; } int Area(int 1, int w) { return 1 * w; }