Level 31
Level 31

Reputation: 403

Taking string input

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.

Upvotes: 1

Views: 392

Answers (1)

Rahul Tripathi
Rahul Tripathi

Reputation: 172378

You can use it like this:-

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

Check out the cin.getline()

Upvotes: 1

Related Questions