Hi there,
I need getch() type function for int through which I can take input from user, to store it in int variable. I actually want to use in menu from which user selectes any number to call that function to carray that task.
Reason of using getch() function is that user did not have to press enter, they just press number and that task is carried out. Thanks !
char no; //I want to declare int
cout<<"Press 1 to add items in stock."<<endl;
cout<<"Press 2 to display stock."<<endl;
cout<<"Press 3 to exit."<<endl;
no = getch(); //alternative of this function for int
if(no == 1)
{
s->addItems();
}
else if(no == 2)
{
s->displayStock();
}
else if(no == 3)
{
cout<<"\nProgram terminated !"<<endl;
}
else
{
cout<<"\nInvalid input !"<<endl;
}