Click here to Skip to main content
16,001,979 members
Please Sign up or sign in to vote.
4.00/5 (4 votes)
See more:
You are to create a Windows application that contains a single form. The form will have three controls, a textbox, a button displaying the text “Parse” and a suitable UI control, preferably scrollable, used to display the results. After entering the text and clicking the Parse button, the program should output the number of times each letter in the alphabet occurs in the textbox. Case sensitivity is not required.
For example, if the user enters “baaad” as the text and hits the Parse Button, the result control should display:
There are 3 A's
There are 1 B's
There are 0 C's
There are 1 D's
There are 0 E's
There are 0 F's
etc...

This my my homework assignment.. Lol First let me say that im Lost!!!!!

I think i figured out how to get the correct count out of the text ive entered in the first textbox... But i dont know how to get it to correctly display "There are 3 A's" etc... in the result control...


Thank You in Advance
Posted

That should be fine, you must be missing something.
 
Share this answer
 
Ok, this is homework, so I'll give you no code example!

for each character (c) in the string increment a count in an array of 26 integers depending on which letter of the alphabet it is.

Then go around a loop 26 times, writing "there are {n} {c}'s" where {n} is the integer from the array, and {c} is the letter.

Write these into a text box which will accept multiple lines, and you are done.

 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900