J
JS
I have made the following code;
#include <stdio.h>
main(){
int c, i, nwhite, nother;
int ndigit[10];
nwhite = nother = 0;
for (i = 0; i < 10; ++i)
ndigit = 0;
while ((c = getchar()) != EOF)
if (c >= '0' && c <= '9')
++ndigit[c-'0'];
else
if (c == ' ' || c == '\n' || c == '\t')
++nwhite;
else
++nother;
printf("digits =");
for (i = 0; i < 10; ++i)
printf(" %d", ndigit);
printf(", white space = %d, other = %d\n",
nwhite, nother);
}
It compiles ok and I also get an .exe file. But when I doubleclick on the
..exe file from WinXP explorer a black box appears and I can enter som text,
press enter and then nothing happens...the black box does not disappear
before I chose to close it.
I use the Cygwin compiler bcause I need my code to be run on a Linux system.
Hope somone can help
JS
#include <stdio.h>
main(){
int c, i, nwhite, nother;
int ndigit[10];
nwhite = nother = 0;
for (i = 0; i < 10; ++i)
ndigit = 0;
while ((c = getchar()) != EOF)
if (c >= '0' && c <= '9')
++ndigit[c-'0'];
else
if (c == ' ' || c == '\n' || c == '\t')
++nwhite;
else
++nother;
printf("digits =");
for (i = 0; i < 10; ++i)
printf(" %d", ndigit);
printf(", white space = %d, other = %d\n",
nwhite, nother);
}
It compiles ok and I also get an .exe file. But when I doubleclick on the
..exe file from WinXP explorer a black box appears and I can enter som text,
press enter and then nothing happens...the black box does not disappear
before I chose to close it.
I use the Cygwin compiler bcause I need my code to be run on a Linux system.
Hope somone can help
JS