Hey I am new to programming altogether and have been following tutorials and writing basic programs etc. I am currently trying to make a program that takes an inputted text and gives the frequency of individual letters. However, my program seems to get stuck in the initial while loop and I it seems that no number of changes can get it to get out of the loop. Here is the code:
If someone could point me in the right direction I would be very thankful.Code:#include <stdio.h> #include <ctype.h> int main(int argc, char *argv[]) { int letters[26] = {0}; int count = 0; int unused_count = 0; int i = 0; printf("Enter text you wish to see letter frequency for:\n"); int current_letter = getchar(); while(current_letter != EOF) { if(isalpha(current_letter)) { count++; letters[tolower(current_letter) - 'a']++;} else { unused_count++;} current_letter = getchar(); } printf("Frequencies:\n"); while (i < 26) { printf("[%c] = %d = %lf%%\n", 'a' + i, letters[i], ((double)letters[i] / count)); i++; } printf("Unused characters: %d", unused_count); getchar(); return 0;