Javatpoint Logo

Input string in c++.

By: mahesh*** On: Sat Nov 11 23:27:37 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
how to take input string with spaces in c++.Up0Down

 
include<stdio.h> Use std::cin and getline each time appending a \n each time. You can input string with white spaces by simply using scanf(" %[^\n]s",s);It will read string up to the newline character.Image Created0Down

By: [email protected] On: Sun Nov 12 11:59:57 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No
 
you can use puts() and gets() in c++ to get input and output string spaces.Image Created0Down

By: [email protected] On: Fri Nov 17 15:43:48 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points2 2User Image
Are You Satisfied :0Yes0No