Write a program that list of letters should be an alphabetical list of upper case letters followed by an alphabetical list of lower case letters.
#include <stdio.h>
main()
{
int i;
char *suffix[]= { "st", "nd", "rd" };
char *item[]= { "Unix" , "cat", "sed", "awk", "grep", "ed", "vi"};
printf("In the beginning, there was nothing.\n");
for (i= 0; i < 7; i++)
printf("And on the %d%s day, God created %s. And it was good.\n",
i + 1, (i < 3) ? suffix[i] : "th", item[i]);
}
But then God saw that vi led people into temptation. Instead of choosing the righteous ways of make, dbx, and RCS, people used long command lines, printf(), and tape backups.
So God decreed, ``I see that Engineers have thus defiled my vi. And so, I shall create emacs, an editor more powerful than words. Further, for each instantiation vi hitherto, the Engineer responsible shalt perform Penance. And lo, the Penance wilt be painful; there will be much wailing and gnushingof teeth. The Engineer will read many lines of text. For each line of text, the Engineer must tell me which letters occur the most frequently.''
``I charge you all with My Golden Rule: 'Friends shalt not let friends use vi'.''
Each line of output should contain a list of letters that all occured with the highest frequency in the corresponding input line, followed by the frequency.
The list of letters should be an alphabetical list of upper case letters followed by an alphabetical list of lower case letters.
When riding your bicycle backwards down a one-way street, if the
wheel falls of a canoe, how many ball bearings does it take to fill
up a water buffalo?
Hello Howard.
Code for Program that list of letters should be an alphabetical list of upper case letters followed by an alphabetical list of lower case letters in C++ Programming
# include <iostream.h>
# include <fstream.h>
# include <string.h>
# include <stdlib.h>
# include <ctype.h>
# include <conio.h>
int main( )
{
clrscr( );
fstream File("CP-14.txt",ios::in|ios::nocreate);
if(!File)
{
cout<<"Unable to open the input file."<<endl;
cout<<"Press any key to exit."<<endl;
getch( );
exit(EXIT_FAILURE);
}
char Data[100]={NULL};
do
{
strset(Data,NULL);
File.getline(Data,80,'\n');
if(strcmp(Data,NULL)==0)
break;
int frequency[52]={0};
int length=strlen(Data);
for(int i=0;i<length;i++)
{
if(isalpha(Data[i]))
{
if(isupper(Data[i]))
frequency[(int(Data[i])-65)]++;
elseif(islower(Data[i]))
frequency[(int(Data[i])-97+26)]++;
}
}
int highest_frequency=0;
for(int j=0;j<52;j++)
{
if(frequency[j]>highest_frequency)
highest_frequency=frequency[j];
}
for(int k=0;k<52;k++)
{
if(frequency[k]==highest_frequency)
{
if(k>=0 && k<=25)
cout<<char((k+65));
elseif(k>=26 && k<=51)
cout<<char((k+97-26));
}
}
cout<<" "<<highest_frequency<<endl;
}
while(1);
File.close( );
getch( );
return 0;
}