expected unqualified-id before '{' token

I've been trying to figure this out for two days but I can't. I keep getting a 55:1: error: expected unqualified-id before '{' token
63:1: error: expected unqualified-id before '{' token on my code

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <cstdlib>
#include <iostream>

using namespace std;

struct height
{
int feet, inches;
};

void input_height (height& p);
void grow (height& p);
void print_height (height p);

int main(int argc, char *argv[])
{

    int inches,  // number of inches to grow, user entered
        inch;    // counter for inches grown so far
		
		height p1, p2;
		

    cout << "Enter the first person's height";
    input_height (p1);
    cout << "\nEnter the second person's height";
    input_height (p2);

    cout << "\nPerson 1";
    print_height (p1);
    cout << "\n\nPerson 2";
    print_height (p2);

    cout << "\n\nEnter a number of inches for Person 1 to grow: ";
    cin >> inches;

    // grow user supplied number of inches
    for (inch = 0; inch < inches; inch++)
        grow (p1);

    cout << "\nPerson 1 after growing " << inches << " inches";
    print_height (p1);

    cout << "\n\n";

    return 0;
}

void input_heigt (height& p);
{
	cout << "\nFeet: ";
	cin >> p.feet;
	cout << "Inches: ";
	cin >> p.inches;
}

void grow (height& p);
{
	p.inches++;
	if (p.inches == 12)
	{
		p.feet++;
		p.inches = 0;
	}
}
void print_height (height p);
{
	cout << "\nFeet: " << p.feet;
	cout << "Inches: " << p.inches;
	
}
Lines 49, 57, and 66 should have the semicolon removed at the end. These are function definitions, not to be confused with function declarations (lines 11, 12, and 13).

Also, you misspelled 'height' on line 49.
Last edited on
Also, check the spelling of the function name in the definition.

void input_heigt (height& p)
Topic archived. No new replies allowed.