Input Statement on C++

a. CIN( )
In C + +, cin command is used to input a value from a input device (keyboard) for further processed by the program.
Syntax is cin>> variable;
example:

court <<"Enter a number:";
cin>> bil;
court <<"You entered number" <<bil "\ n";
b. GETCH ( )
Command getch () function just like cin (command inputs), but getch () specifically for input in the form of characters. Besides, getch () to read input form a space or a tab, whereas cin can not.
syntax is: Variable = getch ();
This function can also be used if the suppression of unwanted ENTER when character data input.

Getche command () uses the same as getch (), the difference is:
- getch () does not display characters diiinput
- getche () displays the inputted character
function getch () and getche () are both needed header files conio.h
Here are examples of the use of getch () and getche ()

char character;
court <<"enter a character:";
character = getch ();
court <<"You typed characters:" <<character;
court <<"enter a character:";
character = getche ();
court <<"You typed characters:" <<character;

0 comments



Recent Entries