How do I get input from user in a vector string (with space counting). | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How do I get input from user in a vector string (with space counting).

31st Dec 2017, 5:31 AM
ƇÅÆÅ™Ć®Ć¶ÅŸ ĆŸÄ…Å”Ć¤Ć±Č› šŸ‡®šŸ‡³
ƇÅÆÅ™Ć®Ć¶ÅŸ ĆŸÄ…Å”Ć¤Ć±Č› šŸ‡®šŸ‡³ - avatar
4 Respostas
+ 5
@Basant, kindly edit your question to include C++ in the question tag, @Calvin was right about tag purpose and usage. Well, to allow a string with whitespace as input you can use: getline(cin, <string_variable>); Is this what you mean? (Edit) I forgot to close the parentheses, fixed now : ) Hth, cmiiw
31st Dec 2017, 6:22 AM
Ipang
+ 4
Relevant tags are required in Q&A Discussion, it helps you find solutions faster. Please remove all tags, and add Cpp tag in this question.
31st Dec 2017, 6:14 AM
CalviÕ²
CalviÕ² - avatar
+ 2
@Basant, can you provide a link to your code, let people see your code so they understand what is the problem and offer suggestion/solution : )
31st Dec 2017, 6:08 AM
Ipang
+ 2
In this code I have taken, input from user using cin, but this won't count a space (if there are spaces in between) so.... https://code.sololearn.com/c8FcPTvTjlh3/?ref=app
31st Dec 2017, 6:11 AM
ƇÅÆÅ™Ć®Ć¶ÅŸ ĆŸÄ…Å”Ć¤Ć±Č› šŸ‡®šŸ‡³
ƇÅÆÅ™Ć®Ć¶ÅŸ ĆŸÄ…Å”Ć¤Ć±Č› šŸ‡®šŸ‡³ - avatar