Could you please tell me what the difference is between these two programs?
please explain in depth what the first program does step by step...
I have written the next program my self, same output:
// Listing 5.1 - demonstrates the use of function prototypes
int FindArea(int length, int width)
cout << "\nHow wide is your yard? ";
cin >> widthOfYard;
cout << "\nHow long is your yard? ";
cin >> lengthOfYard;
areaOfYard= FindArea(lengthOfYard, widthOfYard);
cout << "\nYour yard is ";
cout << areaOfYard;
cout << " square feet\n\n";
int FindArea(int l, int w)
return l * w;
My code is A LOT shorter that the book's code, and it's even easier to understand!
int l, w, a;
cout << "How wide is your yard?\n";
cin >> w;
cout << "How long is your yard?\n";
cin >> l;
a = (l*w);
cout << "Your yard is:" << a << "Square Feet\n";
I dont understand anything about how the first program works, please explain to me!
(I need to proceed to other chapters of the book)