|
|
back to boardhow can i take the line? 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 |
|
|