What is cin.get()? How does it work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is cin.get()? How does it work?

13th Sep 2017, 1:11 PM
Fatin Sadab
Fatin Sadab - avatar
2 Answers
13th Sep 2017, 1:22 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
cin.get() and cin.getline() are usually used to read a string in c++. I can give a small example :- #include<iostream> using namespace std; int main() { char name[50],ch; cout<<"\n Enter your name : "; cin.getline(name,50); cin.get(ch); cout<<" Hello "<<ch; return 0; }
13th Sep 2017, 1:22 PM
RZK 022
RZK 022 - avatar