get() put() functions of stream I/O – CSKC
Sign In

Search

Code Learning #CPP#2160    siteicon   siteicon  

get() put() functions of stream I/O

Using get() and put functions of I/O stream methods like cin and cout.

Learning Objectives

  • Use of get() and put() methods of cin and cout objects of iostream library.

Source Code

TC++ #2160

Source Code

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Code Understanding

char c; cout<<“Enter a single character :”;
Collecting a single character from the user in char data type variable c.

cin.get(c);
Using the get() method of cin object from iostream library header.

cout<<“You entered “;
cout.put(c);
Now using put() method of cout object.

 

Notes

  • The get() and put() functions of cin and cout are sometimes more useful as compared to direct cin and cout stream in terms of handling the character type data.


Suggested Filename(s): getputstream.cpp



Share

Created: 4-Jan-2018 18:55 | Updated: 4-Jan-2018 19:01|