How To Get Full Line User Input in C++| C++ Tutorials For Beginners

Video is ready, Click Here to View ×


In This Video
1) Will learn about how to get full line user input from user.
2) And will also see how String class works in C++.
3) How to print a specific character from a string

In C++ Programming if we declare a string variable and we get input from user than it will only store one word.
But what if we want to get a sentence or more than one word so we can do it with the help of a function which is known as getline() function.
The getline() function takes two arguments
1. the method in this case the method is cin.
2. the name of the variable

in C++ programming string is a class and we can use it’s methods/functions to do programming in a more descriptive way.
Lets say we want to assign a name to a variable so we can do something like that s.assign(“C++ Programming”) it is equal to s = “C++ Programming”

And if we want to print a specific character from a string we can to that by using a function called at(). we can say that name.at(index_of_char). It will print the char at…

c++ tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.