This program user ask to define the getch() function for receiving user selection about character that press on key board. User declares the variables that use to contain the value. In printing criteria user put a query about “do u want to continue (y/n)”. Here if user press ‘Y’ then the character pressed will be selection word as output else the condition will terminate.
Problem Statement:
This is C program user need to define the selection of user in getch() function.
- Declaring the variables.
- Using print method.
- Display result as output.
Here is C source code to define the selection of user in getch() function. The output of this program shown below.
#include <conio.h>
#include <stdio.h>
int main(void) {
char ch;
printf("Do you wish to continue? (Y/N : )");
ch = getche();
if(ch=='Y') {
/* continue with something */
}
return 0;
}