+ 3
What is cin.get()? How does it work?
2 Antworten
+ 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;
}