Advertisement



< 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

Please subscribe to our social media channels for daily updates.


Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page




Advertisement



Notifications



Please check our latest addition

C#, PYTHON and DJANGO


Advertisement