I keep getting EOF when I check50, but my program runs fine. It gives the correct output for every text input. I can not find a solution here. It looks fine, but when I run the check50 command I get several EOF.
Here is my code:
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void)
{
string s = get_string("Text: ");
int countletter = 0;
int countword = 0, t;
int sentence = 0;
int constant = 100;
for(int i = 0; i < strlen(s); i++)
{
if(s[i] != ' ' && s[i] != '!' && s[i] != ',' && s[i] != '.' && s[i] != '?' && s[i] != '\'')
countletter++;
}
for (t = 0; s[t] != '\0'; t++)
{
if (s[t] == ' ' && s[t+1] != ' ')
countword++;
if (s[t] == '.' || s[t] == '!' || s[t] == '?')
sentence++;
}
float L = ((float)countletter/(countword+1))*constant;
float S = ((float)sentence/(countword+1))*constant;
double index = 0.0588 * L - 0.296 * S - 15.8;
if (index > 1 && index < 16)
{
printf("Grade %i\n ", (int) round(index));
}
if (index > 16)
{
printf("Grade 16+\n");
}
if(index < 1)
{
printf ("Before Grade 1\n");
}
return 0;
}