Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 107,639 C++ Programmers for FREE! Ask your question and get quick answers from experts. There are 985 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Need Help Writing A Code.

 
Reply to this topicStart new topic

Need Help Writing A Code., Counting Frequency

michael1201
post 2 Jul, 2008 - 12:05 PM
Post #1


New D.I.C Head

*
Joined: 2 Jul, 2008
Posts: 13

Write a program that prompts the user to enter text from the keyboard. The text is read until Ctrl+Z is entered, i.e., the end of file is reached. The program should count the frequency of each digit and of each letter of the alphabet (but it should not distinguish an uppercase letter from a lowercase letter). When the user finishes inputting text, the program should display each letter and its frequency in a table format. Also, the number of special characters (i.e. not letters nor digits) should be reported.
Hint: Declare an array of counters, one for each letter and for each digit. Use the letter and the digit itself as the subscript that determines which array element to increment. To do this the program must convert the letter and the digit to the corresponding subscript (the ASCII values of the lowercase letters are 97 – 122, the ASCII values for the uppercase letters are 65 – 90 and the ASCII values of the 10 digits are 48-57).

Example:
The following input:
Th1s 1s a test.^Z
Should produce the following result:
1 2
a 1
e 1
h 1
s 3
t 3
Special symbols:4
Additional requirements:
- the program cannot use global variables
- the program must contain at least two functions called count and printReport; formal parameters can be added to these functions (if necessary)


i was just wondering how do i start this??? im lost any help is appreciated
User is offlineProfile CardPM

Go to the top of the page


captainhampton
post 2 Jul, 2008 - 12:08 PM
Post #2


D.I.C Addict

Group Icon
Joined: 17 Oct, 2007
Posts: 501



Thanked 2 times

Dream Kudos: 775
My Contributions


Starting is the key, at least give a smidge of effort towards this as opposed to just posting your homework assignment verbatim. Please at least show us effort and we will be more than happy to help you.
User is offlineProfile CardPM

Go to the top of the page

kapax
post 3 Jul, 2008 - 07:36 AM
Post #3


New D.I.C Head

*
Joined: 2 Jul, 2008
Posts: 33



Thanked 1 times
My Contributions


I would also like to know something.

How to make the program accept the input and continue working when Ctrl+Z is pressed? Is it possible using standard library?
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 8/29/08 06:29PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month