Forum: C Oct 31st, 2009 |
| Replies: 3 Views: 259 It works for both cases here.
I didn't see any glaring problems that relate to your issue.
At line 97 I think you intended something else ...
for(ctr = 0; ctr < strlen(n); ctr++)
sum +=... |
Forum: C Oct 23rd, 2009 |
| Replies: 10 Views: 824 This code is the same as you had. Just re-arranged a little.
I moved the sentence check first to catch the next non dot. The way it was (after the space skip) made it impossible to tell between the... |
Forum: C Oct 21st, 2009 |
| Replies: 10 Views: 824 Sorry for the double post, could not edit for some reason...
Another look, in order to catch the next non dot correctly you have to check before the skip space loop.
#define FALSE 0
#define... |
Forum: C Oct 21st, 2009 |
| Replies: 10 Views: 824 The last condition should not check for new line any more. You want to restart skipping after the last sentence now (when the count is reached as I said). In other words when you do putchar('\n');
... |
Forum: C Oct 20th, 2009 |
| Replies: 10 Views: 824 Just a few things to clear up.
1) How are existing new lines to be handled? If they should be ignored then line 35 should not output if c == EOL.
2) In the skip space loop you will skip new... |
Forum: C Oct 12th, 2009 |
| Replies: 28 Views: 1,640 That will leave leading spaces as well.
Besides the fact it is way more complicated than needed. |
Forum: C Oct 12th, 2009 |
| Replies: 28 Views: 1,640 Make it so it's just like the first time so reset both of em ...
#define EOL '\n'
...
if(c == EOL)
{
putchar(c); |
Forum: C Oct 12th, 2009 |
| Replies: 28 Views: 1,640 Close but not quite right Aia.
This will leave a leading space and a trailing space before the line feed.
You can fix yours OSiRiSsk. Just check for the EOL and reset the flags. |
Forum: C Oct 9th, 2009 |
| Replies: 8 Views: 696 Just change your printf("%c" to printf("|%c" and printf("\n" to printf("|\n"
You should probably split the code into sections though, like: ClearArray, FillArray, and ShowArray. Then you can make... |
Forum: C Oct 9th, 2009 |
| Replies: 28 Views: 1,640 The code as is should work right the first time. If you are reading multiple lines it will start putting leading spaces in because start is not reset for the next one. |
Forum: C Oct 9th, 2009 |
| Replies: 8 Views: 696 You can do this without the 'if' checks and with 2 nested for loops.
Break your problem up to it's smallest pieces and choose a path that solves the pieces with the least redundancy.
Smallest... |