The program won't start [message #1430526] |
Wed, 24 September 2014 13:20 |
Carl-Fabian Strid Messages: 5 Registered: September 2012 |
Junior Member |
|
|
I write the following program in Eclipse c/c++
#include <stdio.h>
#include <math.h>
int main(void){
int blank_cnt = 0,c,digit_cnt = 0,
letter_cnt = 0, nl_cnt = 0, other_cnt = 0;
while ((c = getchar()) != EOF)
if (c == ' ')
++blank_cnt;
else if (c >= '0' && c <= '9')
++digit_cnt;
else if (((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
++letter_cnt;
else if (c == '\n')
++nl_cnt;
else
++other_cnt;
printf("%10s%10s%10s%10s%10s%10s\n\n",
"blanks","digits", "letters","lines", "others", "total");
printf("%10d%10d%10d%10d%10d%10d\n\n", blank_cnt, digit_cnt, letter_cnt, nl_cnt, other_cnt,
blank_cnt + digit_cnt + letter_cnt + nl_cnt + other_cnt);
return 0;
}
But nothing happens. If i type this in the console cnt_char < cnt_char.c, while cnt_char.c is my project name, here to nothing happens. I'm completely new to Eclipse so don't know how to fix this type of problem.
The program should if it work, print counts various kinds of characters
|
|
|
Powered by
FUDForum. Page generated in 0.02923 seconds