Expected unqualified-id

I cannot get this code to compile. Can someone please tell me what is wrong with it? Xcode says that the problem is an "Expected unqualified-id".

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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 #include <iostream>
using namespace std;
bool bach(int year);
int chopin(int month, bool leap);
int mozart(int days_in_month, int month, bool leap, int birthday);
int haydn(bool leap);
int main()
{
    bool leap;
    int year, month, days_in_month, birthday;
    cout << "Enter your birthday in month/day/year. Press enter between each.";
    cout << endl;
    cin >> month;
    cin >> birthday;
    cin >> year;
    leap = bach(year);
    days_in_month = chopin(month, leap);
    cout << "the number of days passed from the beggining of the year you were born to the day you were born is " << mozart(days_in_month, month, leap, birthday) << ".";
    cout << endl;
    
    return 0;
}

bool bach(int year)
{
    if (year / 4 == 0)
        return true;
    else
        return false;
}
int chopin(int month, bool leap)
{
    if (leap == true)
    {
        if (month == 1)
            return 31;
        if (month == 2)
            return 29;
        if (month == 3)
            return 31;
        if (month == 4)
            return 30;
        if (month == 5)
            return 31;
        if (month == 6)
            return 30;
        if (month == 7)
            return 31;
        if (month == 8)
            return 31;
        if (month == 9)
            return 30;
        if (month == 10)
            return 31;
        if (month == 11)
            return 30;
        if (month == 12)
            return 31;
    }
    else if (leap == false)
    {
        if (month == 1)
            return 31;
        if (month == 2)
            return 28;
        if (month == 3)
            return 31;
        if (month == 4)
            return 30;
        if (month == 5)
            return 31;
        if (month == 6)
            return 30;
        if (month == 7)
            return 31;
        if (month == 8)
            return 31;
        if (month == 9)
            return 30;
        if (month == 10)
            return 31;
        if (month == 11)
            return 30;
        if (month == 12)
            return 31;
    }
}

int mozart(int days_in_month, int month, bool leap, int birthday)
{
    if (month == 1)
        return birthday;
    if (month == 2)
        return birthday + 31;
    if (month == 3)
        return birthday + 31 + haydn(leap);
    if (month == 4)
        return birthday + 31 + haydn(leap) + 31;
    if (month == 5)
        return birthday + 31 + haydn(leap) + 31 + 30;
    if (month == 6)
        return birthday + 31 + haydn(leap) + 31 + 30 + 31;
    if (month == 7)
        return birthday + 31 + haydn(leap) + 31 + 30 + 31 + 30;
    if (month == 8)
        return birthday + 31 + haydn(leap) + 31 + 30 + 31 + 30 + 31;
    if (month == 9)
        return birthday + 31 + haydn(leap) + 31 + 30 + 31 + 30 + 31 + 31;
    if (month == 10)
        return birthday + 31 + haydn(leap) + 31 + 30 + 31 + 30 + 31 + 31 + 30;
    if (month == 11)
        return birthday + 31 + haydn(leap) + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31;
    if (month == 12)
        return birthday + 31 + haydn(leap) + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30;
        
}

int haydn(bool leap);
{ // The error occurs on this line according to Xcode. It is an Expected unqualified-id
    if (leap == true)
        return 29;
    else if (leap == false)
        return 28;
}
Last edited on
Semicolon on line 118.
It's always a semi-colon
Thanks very much.
Topic archived. No new replies allowed.