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
  • 383
  • 2
  • 7

1 Answers1

1

You can use it like this:-

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

Check out the cin.getline()

Rahul Tripathi
  • 161,154
  • 30
  • 262
  • 319