0
Is it possible to make my code run without having to press Enter on my IDE? For example: if I'm making a calculator and I want the calculations to be made as soon as I press "=" after typing the numbers and the operator? Say I wanted to add two numbers: can it calculate automatically as soon as I write "2+3=" without having to press Enter?
5 Antworten
+ 2
by using getche() function
+ 1
int a;
while(cin>>a != '=')
{
//some code
}
+ 1
I tried using getche() but my IDE (Xcode) doesn't accept it and switches it to getchar().
Also, could I use getche() for strings or is there another function for that?
0
@Hooman: The code contains at least one severe error.
0
char ch=getche();
//also include conio.h
//only for character