move exercises and lectures into subfolders
This commit is contained in:
28
Lectures/LC7/Getch/getch.c
Normal file
28
Lectures/LC7/Getch/getch.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Chapter 7: example of getch
|
||||
|
||||
This program reads a single keystroke and displays it
|
||||
on the screen
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* Standard include files */
|
||||
#include <stdlib.h>
|
||||
#include <conio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
char x; /* Define a variable of type char */
|
||||
|
||||
printf("Input a character: ");
|
||||
x = getch(); /* Use getchar to read a keypress and store the */
|
||||
/* result in 'x' */
|
||||
printf("\nDisplaying the char with putchar: ");
|
||||
putchar(x); /* Display the character stored in 'x' on the */
|
||||
/* screen using putchar */
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
Reference in New Issue
Block a user