Search This Blog

Friday, December 30, 2011

Use of Getline() in C++

Example

1
2
3
4
5
6
7
8
9
10
11
// getline with strings
#include 
#include 
using namespace std;

int main () {
  string str;
  cout << "Please enter full name: ";
  getline (cin,str);
  cout << "Thank you, " << str << ".\n";
}

No comments:

Post a Comment

Thank you