Heya people i really would appreciate some help here..
The Program Works Just Fine At compiling but after like 1 second after ctrl + f10 to test it i get an error . I looked on google and it is something like Killed by signal 8(SIGFPE).

#include<cstdio>
#include<cctype>
#include<string>

using namespace std;

unsigned int i,l,c;
char txt[500];
FILE *infile;
FILE *outfile;
int main(){
    infile = fopen("text.in", "r");
    outfile = fopen("text.out", "w");

    while(!EOF){
          txt[1] = fgetc (infile);
          if (isalpha(txt[1])){
              c++;
              l+=strlen(txt);
          }
    }
    l=l/c;
    fprintf (infile, "%d", l);

fclose(infile);fclose(outfile);
}

>while(!EOF){
Good luck with this doing anything meaningful. :icon_rolleyes:

>Killed by signal 8(SIGFPE)
Did you look up SIGFPE? The name means that a floating-point exception occurred, but the signal is actually thrown on general arithmetic errors. Normally I'd say to check your math, but your code is actually quite broken in other ways.

I could help more if you explained what the program is supposed to do.

#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */
#define SIGQUIT 3 /* quit */
#define SIGILL 4 /* illegal instruction (not reset when caught) */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGABRT 6 /* abort() */
#if defined(_POSIX_C_SOURCE)
#define SIGPOLL 7 /* pollable event ([XSR] generated, not supported) */
#else /* !_POSIX_C_SOURCE */
#define SIGIOT SIGABRT /* compatibility */
#define SIGEMT 7 /* EMT instruction */
#endif /* !_POSIX_C_SOURCE */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* bus error */
#define SIGSEGV 11 /* segmentation violation */
#define SIGSYS 12 /* bad argument to system call */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define SIGURG 16 /* urgent condition on IO channel */
#define SIGSTOP 17 /* sendable stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */
#if !defined(_POSIX_C_SOURCE)
#define SIGIO 23 /* input/output possible signal */
#endif
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */

So I get a Text For EX :
- I Love Pie Apple ;
And i Need to count the number of word and the number of letters then printf("%d" , number_letters/numbers_words);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.