1

How to take string input in C++?

I generally use gets. But is doesn't work for 2-D arrays. On the other hand cin ignores the text after a blank. I want the input to be the exact unformatted text.

Level 31
  • 403
  • 3
  • 9

1 Answers1

1

You can use it like this:-

char input[100];
cin.getline(input,100);

Check out the cin.getline()

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331