I use DevC++
and I have 2 problems
First Problem: When I declare x = getch(); the getch there is not excluded, I mean you still need to put a value to go to the next statement. Is it possible skipping it in declaring for a variable?Code:#include<stdio.h> #include<conio.h> main() { int x = getch(); printf("1st getch = %d",x); getch(); printf("2nd getch = %d",x); getch(); printf("3rd getch = %d",x); }
Second Problem: The value of the my first getch() will be the value of all getch, I need a way to refresh it or delete the value of it.
For Example: I press Enter
Ascii Value of Enter is 13
Output would be:
1st Getch = 13
2nd Getch = 13 //I press other keys
3rd Getch = 13 //I press a different key
What I want is like
Output:
1st Getch = 13
2nd Getch = ## //The Ascii Value of another key
3rd Getch = ## // The Ascii Value of another key
Please Help . I'm trying to solve this for 2 hours now, I tried fflush(stdin) but it wont work.