// This program asks the user to enter the length of a rectangle
// then for the width of a rectangle , to find the perimeter by
// this 2 * length + 2 * width
#include <iostream.h>
return unsigned long int Perimeter ( unsigned short int , unsigned short int ) ;
// function prototype shown
int main ()
{
unsigned short int length ;
unsigned short int width ;
unsigned long int Perimeter ;
cout << " Please enter the length of the rectangle: " << length << endl ;
cin >> length ;
cout << " Please enter the width of the rectangle: " << width << "\n" ;
cin >> width ;
length = 2 * length ;
width = 2 * width ;
Perimeter = Perimeter ( unsigned short int length , unsigned short int width ) ;
cout << " The Perimeter of the rectangle is: " << Perimeter << endl ;
return 0 ;
}
return unsigned long int Perimeter( unsigned short int length , unsigned short int width )
{
return 2 * length + 2 * width ;
}
This doesn't work.I know I screwd up with the variables names somehow but can't just find it :sad:
Here is the error report:
Compiling...
Bug Busters.cpp
D:\Microsoft Visual Studio\VC98\Bin\Day 5- Bug Busting\Day5Bugbusting\Bug Busters.cpp(2) : error C2143: syntax error : missing ';' before 'return'
D:\Microsoft Visual Studio\VC98\Bin\Day 5- Bug Busting\Day5Bugbusting\Bug Busters.cpp(18) : error C2144: syntax error : missing ')' before type 'unsigned short'
D:\Microsoft Visual Studio\VC98\Bin\Day 5- Bug Busting\Day5Bugbusting\Bug Busters.cpp(18) : error C2064: term does not evaluate to a function
D:\Microsoft Visual Studio\VC98\Bin\Day 5- Bug Busting\Day5Bugbusting\Bug Busters.cpp(18) : error C2059: syntax error : ')'
D:\Microsoft Visual Studio\VC98\Bin\Day 5- Bug Busting\Day5Bugbusting\Bug Busters.cpp(23) : error C2143: syntax error : missing ';' before 'return'
D:\Microsoft Visual Studio\VC98\Bin\Day 5- Bug Busting\Day5Bugbusting\Bug Busters.cpp(24) : error C2143: syntax error : missing ';' before '{'
D:\Microsoft Visual Studio\VC98\Bin\Day 5- Bug Busting\Day5Bugbusting\Bug Busters.cpp(24) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.
Bug Busters.obj - 7 error(s), 0 warning(s)
Somebody plz show the error and explain why..