#include
#include
int main(void) {
//user information
printf("This programme counts the number of each letter in passage.txt.");
//define file and arrays.
FILE *FileReference;
char Letter[2]= {0}, ArrayOfLetters[128]= {0};
int i=65;
//open file
FileReference=fopen("passage.txt", "r");
if (FileReference == NULL) {
printf("File did not open correctly\n");
return 1;
}
//Loop for capital letters
for (i=65; i<=90; i++) {
while (fgets(Letter,2,stdin) !=0) {
ArrayOfLetters[(Letter[2])]++;
}
}
printf("\n\n%d=%s", ArrayOfLetters, ArrayOfLetters);
return 0;
}
2006-11-27
20:09:46
·
6 answers
·
asked by
sarciness
3
in
Programming & Design