+ 4
How to use gets() in cpp
these days I am learning strings and arrays in cpp. In my school they taught us to take a string as user input, one have to use gets() but it isn't working on any of the compilers I have. I have already tried using cstdio library, still errors. I know cin.getline() but it is a bit bigger word. plz help edit::: I forgot HAPPY CHRISTMAS TO ALL OF YOU!!!đđ«đđđ ENJOY AANNNNDDD PARTY HARD!!!đ
6 Answers
+ 6
getline(cin,variable);
Is my way of getting input with spaces
https://code.sololearn.com/cp32oQ9205NP/?ref=app
+ 6
Have you used
scanf()?
https://code.sololearn.com/cZLBkotx6sNg/?ref=app
+ 5
I agree with @Gordie . Do not use gets. cin>> is better in cpp
+ 2
thnx @gordie
manual I tried scanf() in ur code
but it takes spaces as termination just like cin
thnx for ur help
- 1
another problem
SL doesnt recognise cin.get
i have to use cin.getline