How many non-letters are included in the string, C/C++ Programming

Assignment Help:

Write a fully modular C program that reads in a string of a defined size from the keyboard and reports how many times each letter of the alphabet occurs within that string (ignoring case). It should also report how many non-letters are included in the string.


 Although this is a relatively simple problem, doing it well is slightly more complicated than it may look at first.  Here are some hints:

·  The obvious solution is simply to iterate through the string using a gigantic switch-case statement to increment one of 27 integer variables (one for each of the letters of the alphabet and an additional variable to store the non-alphabetic characters).  This is the WRONG solution: it will work but it's a poor design and is inefficient and will NOT give you good marks.

·  To solve the problem much more elegantly and with code that is a tiny fraction of the length, you first need to think about the data required to be stored.  In particular, try to identify a certain complex data type that is well-suited to store large amounts of data all of the same type.

·  Once you've done this, you then need to find a way of mapping each character in the string to the appropriate element in your data: this is actually much easier than it initially looks if you remember how character data is really stored internally and bear in mind the ordinal properties of the alphabetic characters of either case in the ASCII table (remember you can ignore case by simply converting the entire string to all one case).

 


Related Discussions:- How many non-letters are included in the string

AREA UNDER CURVE, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

M--commerce, Project Description: We are aiming to prepare an industry f...

Project Description: We are aiming to prepare an industry first in the m-commerce world. M-commerce payment processing programmers required Skills required are C Programmi

Algorithm, write a pseudo code for computing sin(x) using sentinel control ...

write a pseudo code for computing sin(x) using sentinel control loop

Should my class declare a friend function or member function, A: Use a memb...

A: Use a member while you can and a friend when you need to. Sometimes friends are better syntactically (e.g., in class Fred, friend functions let the Fred parameter to be secon

Boolean functions and simple logic design, The digital signal is one which ...

The digital signal is one which only consists of two states i.e. logic '1'   (+5 volts) and logic '0' (0 volts). Various electronic blocks use logic and these form the basis of a m

#decode the code, #Smugglers are becoming very smart day by day. Now they h...

#Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new techn

Flowchart, how to define a contanst in a flowchart like we do in c language...

how to define a contanst in a flowchart like we do in c language

C program for create matrices , C Program for CREATE MATRICES #include...

C Program for CREATE MATRICES #include stdio.h> #include conio.h> void main() {           int a[10][10],rw=0,clm=0,i=0,j=0;           char s=' ';           c

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd