Error Help

Hey there, I'm getting an error and need help understanding it. Here is the coded i have:


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
#include <iostream> 
using namespace std; 
 
struct english_area //english structure 
{ 
int feet; // int for feet  
int inches; // int for inches  
 
}; 
 
english_area( (a * 12 + b) * (c * 12 + d) ) 
{ 
      
}; 
 
 
void read_english() 
{ 
          cout << "Enter feet: " << endl;  
          cin >> feet; 
 
          cout << "Enter inches: " << endl; 
          cin >> inches; 
}; 
 
void read_english(int ft, int in) //display distance 
{ cout << ft << "\'-" << in << '\"'; }


here is the error:

1>------ Build started: Project: Programming__TEST_2, Configuration: Debug Win32 ------
1>Build started 10/16/2012 10:54:27 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Programming__TEST_2.unsuccessfulbuild".
1>ClCompile:
1> english.cpp
1>c:\users\colby crowder\documents\visual studio 2010\projects\programming__test_2\programming__test_2\english.cpp(11): error C2143: syntax error : missing ')' before '*'
1>c:\users\colby crowder\documents\visual studio 2010\projects\programming__test_2\programming__test_2\english.cpp(11): error C2059: syntax error : ')'
1>c:\users\colby crowder\documents\visual studio 2010\projects\programming__test_2\programming__test_2\english.cpp(12): error C2143: syntax error : missing ';' before '{'
1>c:\users\colby crowder\documents\visual studio 2010\projects\programming__test_2\programming__test_2\english.cpp(12): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\colby crowder\documents\visual studio 2010\projects\programming__test_2\programming__test_2\english.cpp(20): error C2065: 'feet' : undeclared identifier
1>c:\users\colby crowder\documents\visual studio 2010\projects\programming__test_2\programming__test_2\english.cpp(23): error C2065: 'inches' : undeclared identifier
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.54
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
There are a number of major problems.

1. No main function.

2. With this:
1
2
english_area( (a * 12 + b) * (c * 12 + d) ) 
{ 


english_area is a structure, but you have made it look like a function call. You need to have a function which does this calculation. The function needs to return a value.

3. In main, you need to create an object of type english_area, so that you can reference the variables feet & inches.

Try sorting these things out, and see how you go.

HTH
Topic archived. No new replies allowed.