A guy at work has a son taking C++ in highschool. He asked me if I could look at the programs. In college, I took QBasic, Cobol, and RPG. I had hoped that if I looked at these two programs for him I might could just glance them over and find something out of the ordinary. Unfortunately, it looks as if I don't have a clude. These are two VERY SIMPLE problems so hopefully some one can look over them and let me know what you think.
Problem 1 - Rectangle 2
#include <iostream>
using namespace std;
int main();
{ int Width, Length, Area;
cout<<"Please insert the Width"<<endl;
cin>>Width;
cout<<"Please insert the Length"<<endl;
cin>>Length;
cout<<"The Area is:"<<Area<<endl;
system("PAUSE");
return 0;
}
**Error Report***
------ Rebuild All started: Project: Rectangle2, Configuration: Debug Win32 ------
Deleting intermediate and output files for project 'Rectangle2', configuration 'Debug|Win32'
Compiling...
Rectangle2.cpp
c:\documents and settings\compaq_owner\my documents\visual studio 2005\projects\rectangle2\rectangle2\rectangle2.cpp(5) : error C2447: '{' : missing function header (old-style formal list?)
Build log was saved at "file://c:\Documents and Settings\Compaq_Owner\My Documents\Visual Studio 2005\Projects\Rectangle2\Rectangle2\Debug\BuildLog.htm"
Rectangle2 - 1 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Problem 2 - Area of a trapazoid
//used to stream input and output
#include <iostream>
//used so that std:: isn't used repeatedly
using namespace std;
//starts flip void(unsure)
int flip (void);
//starts main application
int main()
{
cout<<"Now in the flip function" << endl;
return 1;
//Names all of the containment files that will be used
{double baseOne, baseTwo, baseSum, completebaseSum, Altitude, Area;
//Will print the following text on screen
cout<<"What is the length of the first base of the Trapezoid?"<<endl;
//stores data entered by user in baseOne containment file
cin>> baseOne;
//Will print the following text on screen
cout<<"What is the length of the second base of the Treapezoid?"<<endl;
//stores data entered by user in baseTwo containment file
cin>> baseTwo;
//the formula used to combine the two bases and divide it
baseSum = (baseOne + baseTwo);
completebaseSum = (baseSum / 2);
//Will print the following text on screen
cout<<"What is the altitude of the Trapezoid?"<<endl;
//stores data entered by user in Altitue containment file
cin>> Altitude;
//formula used to solve the area of the trapezoid
Area = (Altitude * completebaseSum);
//Will print the following text on screen
cout<<"The area of the Trapezoid is:"<< Area<< endl;
system("PAUSE");
//closes console
return 0;
}
I think his dad wrote the second program for him. I'm not sure why, but he didn't e-mail me any details about the second program. His dad mentioned at work, though, that one of the programs wouldn't compile because it was having trouble with the #include <iostream> line.
Any information you can provide will be greatly appreciated.
Thanks,
Magus