error message: expected initializer before 'do'


I'm getting the error mesage: expected initializer before 'do' and im not sure what it means, can anyone shed some light on my problem.

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

#include<iostream>
using namespace std;

int main()

{

int n



do { 

cout << " Please input a number:";
cin >> n;


if(n>=1 && n<=10){ 



cout << "I have to print this out.\n";
exit(1);



                  }

else {
cout << "\a";
cout << "Not in range, please input another number;";
cin >> n;

     }

while(n>=1 && n<=10) 

return 0;

  } 
}

You forgot a semicolon at line 9
The brace at line 40 should be at line 37 and after the while condition you should have a semicolon
Topic archived. No new replies allowed.