DATA INPUT AND OUTPUT:-  Input /output (I/o) functions are directly performed by C + +. These are the header files which help in performing input/output function. cin and cout functions help in performing input and output activities. Cin and cout remain present in iostream.h header file. # include C + + provides a large variety of functions to deal with characters and input/output operations. These functions are: 1    getchar ( ) 2    putchar ( ) 3    gets ( ) 4    puts ( ) These functions are also termed as unformatted console I/o functions. Character functions getchar ( ) and putchar ( ):- These functions are based on characters for input and output operations.   1. getchar ( ):- The function getchar ( ) reads a single character from the standard input device such as usually a key – board. It is worth noting when getchar is used; the execution of the program is temporarily suspended. When the character is typed by the user from the key-board, then this character is communicated to the program. The suspended execution starts again. No argument s/is/are required in the function because getchar function reads a simple character in given time.  ………….. ………….. char ch; ch = getchar ( ); ………….. ………….. The function char is included in stdio.h header file. Example: Write a small C ++ pgm which illustrates the use of getchar ( ). # include # include main ( ) { char character; cout

Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments