![]() |
| | #1 |
| Registered User Join Date: Sep 2003
Posts: 2
| |
| yoyo is offline | |
| | #2 |
| unleashed Join Date: Sep 2003
Posts: 693
| Just to give you some hints. It's a newline after you encounter '\n' and if the text is like this... xxxxxxxxxxxxx xxxxxxxxxxx xxx xxxxx xx xxxxx xxxxxxxxxx xxxxxxxx xxxxxx ----->xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxxxxxx xxxxxxx then a a paragraph is when you encounter " " after '\n' That's one way, the easiest that I could think of for newbee |
| alphaoide is offline | |
| | #3 |
| Pursuing knowledge Join Date: Jun 2002
Posts: 1,916
| http://faq.cprogramming.com/cgi-bin/smartfaq.cgi There are several things in "How do I...level 2" that might be of help
__________________ Away. |
| confuted is offline | |
| | #4 | |
| Registered User Join Date: Sep 2003
Posts: 2
| Quote:
| |
| yoyo is offline | |
| | #5 |
| Registered User Join Date: Mar 2002
Posts: 1,595
| >> ignores leading white space but doesn't ignore terminating whitespace. Any whitespace char (space, tab, carraige return, newline char, etc) will terminate input. Therefore, if you just use >> you will not be able to tell what caused termination. Since >> leaves the terminating char in the input buffer, you can figure it out, but.....then you might as well read char by char in the first place. That way you can look at the next char once you find a target char. Target char may be spaces (there are routinely two spaces after the last word of a sentence and before the first word of the next sentence) or new line char(if the next char after the new line char is a space followed by a new line char or a new line char itself, then you have (probably) found a new paragraph and not a new line. |
| elad is offline | |
| | #6 |
| Grammar Police Join Date: Jan 2003
Posts: 355
| Hi yoyo, Your algorithm will be useless if you type the file, you don't use any full stops or paragraphs! :P
__________________ Thor's self help tip: Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again. OS: Windows XP Compiler: MSVC |
| HybridM is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cin.ignore and cin.get in C | Trafalgar Law | C Programming | 5 | 11-24-2008 10:34 AM |
| cin.get and cin.ignore | Trafalgar Law | C++ Programming | 1 | 09-24-2008 09:49 AM |
| cin.get(); doesn't work even with cin.ignore(); | calumn | C++ Programming | 34 | 05-14-2006 11:12 AM |
| cin.ignore() & cin.get() | dragonlady | C++ Programming | 11 | 08-08-2005 11:38 PM |
| Confused about cin.get(); and classes. | RaccoonKing | C++ Programming | 6 | 07-17-2005 11:44 AM |