1.

Distinguish between get() and put() functions.

Answer»

1. get() function: 

get() is an input function. It is used to read a single character and it does not ignore the white spaces and newline character.

Syntax is cin.get(variable); 

Eg. char ch; 

cin.get(ch);

2. put() function:

put() is an output function. It is used to print a character. 

Syntax is cout.put(variable); 

Eg. char ch; 

cin.get(ch); 

cout.put(ch);

The main difference between gets and puts in C Language is that gets is a function that reads a string from standard input while puts is a function that prints a string to the standard output.


Discussion

No Comment Found