i need help with this it wont compile!

closed account (3hkyhbRD)
im sorry for my actions in the past at this forum but i need help.
here is my code


#include "stdafx.h"
#include <iostream>
using namespace std;
typedef unsigned short us;
us FindArea(us length, us witdth);

int main()
{
us lengthofyard;
us widthofyard;
us areaofyard;

cout << "\nHow wide is your yard?";
cin >> widthofyard;
cout "\n How long is yur yard?";
cin >> lengthofyard;

areaofyard= FindArea(lengthofyard,widthofyard);

cout << "\nYour yard is ";
cout << areaOfYard;
cout << " square feet\n\n";
return 0;
}

us FindArea(us 1, us w)
{
return 1 * w;
}

also my error code!

------ Build started: Project: functions, Configuration: Debug Win32 ------
functions.cpp
functions.cpp(17): error C2143: syntax error : missing ';' before 'string'
functions.cpp(23): error C2065: 'areaOfYard' : undeclared identifier
functions.cpp(28): error C2143: syntax error : missing ')' before 'constant'
functions.cpp(28): error C2143: syntax error : missing ';' before 'constant'
functions.cpp(28): error C2059: syntax error : ')'
functions.cpp(29): error C2143: syntax error : missing ';' before '{'
functions.cpp(29): error C2447: '{' : missing function header (old-style formal list?)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "stdafx.h"
#include <iostream>
using namespace std;

typedef unsigned short us;

us FindArea(us length, us witdth);

int main()
{
   us lengthofyard;
   us widthofyard;
   us areaofyard;

   cout << "\nHow wide is your yard?";
   cin >> widthofyard;
   cout "\n How long is yur yard?";//you're missing a << here
   cin >> lengthofyard;

   areaofyard= FindArea(lengthofyard,widthofyard);

   cout << "\nYour yard is ";
   cout << areaOfYard;//C++ is case sensitive
   cout << " square feet\n\n";
   return 0;
}

us FindArea(us 1, us w)//"1" is not a valid argument name
{
   return 1 * w;//why would you return w as area? what about height?
}
Replace "1" with "l" and that last function makes more sense. Perhaps TC copied it from his instructor writing on the board?
Topic archived. No new replies allowed.