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

What is function overloading, Question 1 What is function overloading? Wri...

Question 1 What is function overloading? Write a c++ program to implement a function overloaded Question 2 Explain about the constructors and Destructors with suitable exampl

Define commonly used built-in library functions, Define Commonly Used Built...

Define Commonly Used Built-in Library Functions? Comprise opened a file pointer you will desire to use it for either input or output. The C language supplies a set of functions

C program to check even & odd no, C Program to Check  EVEN & ODD NO   ...

C Program to Check  EVEN & ODD NO   main() {           int n, a;           clrscr();           printf("ENTER ANY NUMBER: ");           scanf("%d", &n);

Advance in c, create a program to populate the first array then the odd num...

create a program to populate the first array then the odd number is the second array and get the sum of the second array.

Minimumshelf, At a shop of marbles, packs of marbles are prepared. Packets ...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

What does odbc do in context with php, What does ODBC do in context with PH...

What does ODBC do in context with PHP? PHP supports many databases such as dBase, Microsoft SQL Server, Oracle, etc. however, it also supports databases such as filePro, FrontB

C program for swapping the string, C Program for SWAPPING THE STRING #i...

C Program for SWAPPING THE STRING #include conio.h> #include stdio.h> void main() {           char a[50],temp=0;           int i=0,c=0,c1=0,l=0;           clr

code, direction[] = {L,R,R,L,L,R,R,R,R,L,Z} length[]= {2,2,1,1,1,2,5,2,2,3...

direction[] = {L,R,R,L,L,R,R,R,R,L,Z} length[]= {2,2,1,1,1,2,5,2,2,3,1}

Explain the new and delete operators, The new and delete operators The ...

The new and delete operators The C language has explained library functions- malloc() and free() for dynamic allocation and de-allocation of memory. C++ gives yet another appro

Help me for an programming contest .., Pebble Merchant Problem Description...

Pebble Merchant Problem Description There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides

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