Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » The program won't start (Problem with c code)
The program won't start [message #1430526] Wed, 24 September 2014 13:20
Carl-Fabian Strid is currently offline Carl-Fabian StridFriend
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




Previous Topic:C CODE GENERATION FROM STMubeMX
Next Topic:how to change path of "configure" script created by CDT AUTOTOOLS
Goto Forum:
  


Current Time: Fri Oct 11 15:19:16 GMT 2024

Powered by FUDForum. Page generated in 0.02923 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top