expected unqualified-id before '{' error

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
#include <iostream>

using namespace std;

int age;
int option;
int input;

int avengers();
int batman();
int django();

int main ()

{
    cout<<"Welcome to my program"<<endl;
    cout<<"Please choose what movie you would like to see"<<endl;
    cout<<"Enter 1: The Avengers"<<endl;
    cout<<"Enter 2: Batman The Cartoon"<<endl;
    cout<<"Enter 3: Django"<<endl;
    
    if (input == 1)
    {
            int avengers();
    }
   
   if (input == 2)
   { 
            int batman();
   }
   
   if (input == 3)
   { 
           int django();
   }
             
   if (input != 1 && input !=2 && input !=3)
   {
             cout<<"Error! only 1, 2 or 3 is accepted"<<endl;
             cout<<"Please check and try again";
             }
             
  system("pause");                  
}

int avengers();
   {
       int age;        
       cout<<"Enter your age";
       cin>>age;
       if (age<16)
       cout<<"You are not allowed to watch this movie"<<endl;
       else if (age>=16)
       cout<<"You are allowed to watch this movie"<<endl;
       }
       
int batman();
   {
       int age;     
       cout<<"Enter your age";
       cin>>age;
       if (age<12)
       cout<<"You are not allowed to watch this movie"<<endl;
       else if (age>=12)
       cout<<"You are allowed to watch this movie"<<endl;
       }
       
int django();
   {
       int age;      
       cout<<"Enter your age";
       cin>>age;
       if (age<18)
       cout<<"You are not allowed to watch this movie"<<endl;
       else if (age>=18)
       cout<<"You are allowed to watch this movie"<<endl;
       }
       
       
 
   }
           
                               


I don't know what to do :( please help me
The error shows on line 50
Remove the semi-colons on lines 46, 57 and 68.
I removed the semi-colons but now I got an error on line 47. When I take off the curly bracket on line 47 I get another error on line 49.
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
#include <iostream>
#include <cstdlib>

using namespace std;

void avengers();
void batman();
void django();

int main ()
{
    cout << "Welcome to my program" << endl;
    cout  << "Please choose what movie you would like to see" << endl;
    cout << "Enter 1: The Avengers" << endl;
    cout << "Enter 2: Batman The Cartoon" << endl;
    cout << "Enter 3: Django" << endl;
    
    int input = 0;

    cin >> input;

    switch( input )
    {
         case 1:
            avengers();
            break;
   
        case 2:
            batman();
            break;
   
       case 3:
           django();
            break;
             
       default:
            cout<<"Error! only 1, 2 or 3 is accepted"<<endl;
            cout<<"Please check and try again";
            break;
    }
             
    system( "pause" );                  
}

void avengers()
{
       int age;
        
       cout << "Enter your age: ";
       cin>>age;

       if ( age < 16 )
              cout << "You are not allowed to watch this movie" << endl;
       else
              cout << "You are allowed to watch this movie" << endl;
}
       
void batman()
{
       int age;
     
       cout << "Enter your age";
       cin >> age;

       if ( age < 12 )
              cout << "You are not allowed to watch this movie" << endl;
       else
              cout << "You are allowed to watch this movie" << endl;
}
       
void django()
{
       int age;      

       cout << "Enter your age";
       cin >> age;

       if ( age < 18 )
              cout << "You are not allowed to watch this movie" << endl;
       else 
              cout << "You are allowed to watch this movie" << endl;
}

Last edited on
Thank you
Topic archived. No new replies allowed.