ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1567. SMS-spam

how can i take the line?
Posted by shahmohammadi 8 Jul 2011 04:10
what is the last character in the line? '\0' or '\n'
when i use cin>>s; or scanf("%s",&s); it only take the first word. so how can i take the line?

thank you.
Re: how can i take the line?
Posted by hatred 9 Jul 2011 21:17
you may get the whole line using gets(s) (defined in cstdio) or cin.getline(s) (iostream).
also you may get characters from input by 1 char.
char c;
while ((c= getchar()) != EOF) { /* your code */ }

or

char c;
while (cin >> c) { ... }


Edited by author 09.07.2011 21:17