Witam, chcę zliczyć duże i małe znaki w tekście. Mam takie coś:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main()
{
char str[100];
int i;
int upper = 0, lower = 0;
puts("Podaj ciag znakow: ");
fgets(str, sizeof str, stdin);
for(i=0; i < sizeof str; i++) {
if(str[i] != EOF) {
if(isupper(str[i])) {
upper++;
} else if(islower(str[i])) {
lower++;
}
}
}
printf("Duze litery: %d\nMale litery: %d", upper, lower);
return 0;
}
Dla danych "Ala ma kota" wyświetla mi:
Duze litery: 4
Male litery: 18
Co jest źle w tym programie?