|
From: Per W. <pw...@ia...> - 2006-01-10 19:00:59
|
Short note: "empty" loops are quite common, i.e. all the side effects are
in the second and third expression.
/Per W
On Tue, 10 Jan 2006 dz...@su... wrote:
> Mr. Lefebvre,
>
> In you "for()" loop you left out the "{" & "}" braces
> defining your loop.
>
> Try the following changes listed below. This worked
> for me.
>
> ..Bob
>
> #include <stdio.h>
> #include <stdlib.h>
>
> main()
> {
> long nc;
> nc=0;
>
> for (nc=0; getchar()!=EOF; ++nc)
> { //opening brace for "for()" loop.
> printf("%ld\n",nc);
> system("Pause");
> } //closing brace for "for()" loop.
>
> return 0;
> }
>
>
>
> --------------------------------------------------------------------Fr
> om: dev...@li...
> [mailto:dev...@li...] On Behalf Of Gary
> Lefebvre
> Sent: Tuesday, January 10, 2006 9:32 AM
> To: dev...@li...
> Subject: [Dev-C++] Loops
>
>
> #include <stdio.h>
> #include <stdlib.h>
>
> main()
> {
> long nc;
> nc=0;
>
> for (nc=0; getchar()!=EOF; ++nc);
> printf("%ld\n",nc);
> system("Pause");
>
> return 0;
> }
>
>
> No matter what loop option I try I have the same result. The loop
> does not terminate when, after entering text, I press the enter key.
> The command window hangs. The loop will not terminate to proceed to
> the rest of the code.
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored
|