#include <iostream>
#include <string>
using namespace std;
int main()
{
string username;
cout<< "username" ;
cin >> username;
}
So I was curious on what's the difference between these two codes, I heard it's the same thing but if it is then why two ways of doing it then?
#include <iostream>
#include <string>
using namespace std;
int main()
{
string username;
cout << "username" ;
getline (cin,username) ;
}
See Question&Answers more detail:os