i am facing one error while running this programe. the problem is in the main().

initialization of "i" is skipped by "case" lebel..plz help me.


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
int main ()
{
 diary myContacts[5];

while (1) {
cout << "Press 1 to add contact" << endl;
cout << "Press 2 to display contact" << endl;

int choice;
cin >> choice;

switch (choice) {
case 1:
	for(int i=0;i<5;i++){
	myContacts[i].addContact();
break;
case 2://here is the problem
	for(int i=0;i<5;i++){

	myContacts[i].displayContact();
 return (0); 
}	
}
}

}
}
Last edited on
My first piece of advice would be to sort your brackets out. They're all over the place.
Topic archived. No new replies allowed.