P
Pete
Below I have attempted to write code to check through the alphabet 1 letter
at a time checking the frequency of each letter in the hard coded string and
printing it to screen. The code below goes into an endless loop.
Can somone please suggest the correct method for acheiving the correct
outcome.
#include <stdio.h>
#include <string.h>
unsigned int i,j;
int count=0;
main()
{
char Alphab[26]={'a','b','c','d','e','f','g','h','i','j','k',
'l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char* str = "it was disclosed yesterday that several informal\n"
"but direct contacts have been made with political\n"
"representatives of the viet cong in moscow\0n";
while(str!= "\0") {
for(i=0; i<27; i++)
for(j=0; j<120; j++)
{
if
(Alphab==str[j]);
count++;
printf("The letter %c has been used %d times ", Alphab, count);
}
}
}
at a time checking the frequency of each letter in the hard coded string and
printing it to screen. The code below goes into an endless loop.
Can somone please suggest the correct method for acheiving the correct
outcome.
#include <stdio.h>
#include <string.h>
unsigned int i,j;
int count=0;
main()
{
char Alphab[26]={'a','b','c','d','e','f','g','h','i','j','k',
'l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char* str = "it was disclosed yesterday that several informal\n"
"but direct contacts have been made with political\n"
"representatives of the viet cong in moscow\0n";
while(str!= "\0") {
for(i=0; i<27; i++)
for(j=0; j<120; j++)
{
if
(Alphab==str[j]);
count++;
printf("The letter %c has been used %d times ", Alphab, count);
}
}
}