Professional Documents
Culture Documents
STATEMENTS
(Turbo C)
Topics Outline
Input Statements
Output Statements
Format Specifiers
Input Statements
Input Statement
A statement used to input a single
character or a sequence of characters from the
keyboard.
Input Statements (cont.)
Input Functions:
1. getch – a function used to input a single
character from the keyboard without
echoing the character on the monitor.
Syntax: getch();
Example: ch = getch();
Input Statements (cont.)
Syntax: getche();
Example: ch = getche();
Input Statements (cont.)
Syntax: getchar();
Example: ch = getchar();
Input Statements (cont.)
Syntax: gets();
Example: gets(ch);
Input Statements (cont.)
Output Statement
A statement used to display the argument
list or string on the monitor.
Output Statements (cont.)
Output Functions:
1. printf – a function used to display the
argument list on the monitor. It sometimes
needs the control string codes to help
display the remaining argument on the
screen.
Syntax: printf(“control string codes”, argument list);
Example: printf(“Hello %s, you’re %d yrsold”, name, age);
Output Statements (cont.)
Output Functions:
2. putchar – a function used to display the
argument list or string on the monitor. It is
like overwriting a character.
Syntax: putchar();
Example: putchar(tolower (ch));
Output Statements (cont.)
Output Functions:
3. puts – a function used to display the
argument list or string on the monitor. It
does not need the help of the control string
codes.
Syntax: puts();
Example: puts(“hello”);
Format Specifiers