do{
cout<<"Enter the task to perform \n";
cout<<"1. push an element \n";
cout<<"2. pop an element \n";
cout<<"3. peep the elements \n";
cout<<"4. retain odd elements \n";
cout<<"5. remove till element n \n";
cout<<"6. Display the elements \n";
cout<<"7. exit \n";
cin>>a;
switch(a){
case 1:
.
.
.
.
case 2:
case 7:
return 1;
default:
cout<<"Crap entry Reenter \n\n\n\n\n";
}
}while(a != 7);
return 0;
This is my code where i am trying to make a stack And If i Enter a character in the switch case I get an infinite while loop Why is it so