by Dinesh Thakur Category: C Programming (Pratical)

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.

  1. Declaring the variables.
  2. Using print method.
  3. 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;
}
 Program for getch() to Receive user Selection


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.