< Prev
Next >



C++ Reading string from console






In C++, we can read string entered by a user at console using an object cin of istream class and an in-built function - getline(). C++ gives us two approaches through which we could create a string -


Now based on approach we have used to create the string(char array or string class), there are two variants of getline() function in C++ we could use to read string from the console. Let's take a look at these functions one-by-one and see how they are used to read the strings typed at the console.




Please subscribe our social media channels for notifications, we post a new article everyday.

Decodejava Google+ Page Decodejava Facebook Page  DecodeJava Twitter Page

Coming Next
-
Python

Ad2