When I give a character input to 'choice', default statement is executed repeatedly. 'cin' instruction is not blocking the execution.
#include<iostream>
using namespace std;
main()
{
int choice;
do{
cout<<"Enter your choice: ";
cin>>choice; //I'm giving character i/p even though 'choice' is int
switch(choice)
{
case 1:cout<<"\n 1 \n";
break;
case 2:cout<<"\n 2 \n";
break;
case 3:cout<<"\n 3 \n";
break;
case 4:cout<<"\n 4 \n";
return 0;
default:cout<<"An Invalid choice."<<endl;
}
}while(1);
cout<<"\n Hello";
}