Another Example
Write a program which can say which key you have
pressed from the key board? [Suppose you can press any digit, character or
functional key on the key board. After scanning that information the program
has to say the category of key.]
wb‡Pi Program wU
F7 w`‡q
execute Kiv‡bv
hvB‡e bv Ctrl+F9 execute Ki‡Z n‡e| Explain.
DËit
F7 wb‡RB GKwU functional key hvi ASKEY value-Gi cª_g Ask 0. GB program wU F7 w`‡q execute
Kiv‡bvi mgq Qó jvB‡b getch()
Gi gva¨‡g ASKEY value-Gi
cª_g Ask 0 co‡j Dnv num variable-Gi wfZi Rgv ev store nq hvnv mßg jvB‡bi while condition-‡K K‡i ‡`q| d‡j, compiler while loop - Gi body - ‡Z XzK‡Z cv‡i b|
GKvi‡b Program wU F7 w`‡q
execute Kiv‡bv
hvB‡e bv
#include<stdio.h>
#include<conio.h>
void main(){
int num,m;
printf("\nEnter an inter vlaue
=");
num = getch();
while(num != 0){
printf("\nAskey = %d",num);
num = getch();
}
}
No comments:
Post a Comment