# HW2 - EE 361 Spring 2008 Homework 2 Due Monday Be sure to keep track of and report in the comment section at the beginning of your homework

This preview shows pages 1–3. Sign up to view the full content.

EE 361 Spring 2008 Homework 2 Due: Monday, February 25, 2008 Be sure to keep track of and report in the comment section at the beginning of your homework soloution: (1) The number of times you compile your code and (2) The total amount of time you spent, the time you spent thinking and writing algorithm before you started typing code (T time), the time you spent eliminating syntax errors (S time), and the time you spent debugging logical errors (D time). Total time should be (T time + S time + D time). Programming Problems: 1. Write a function CountLetters that will read a line of text from the user and output a list of all the letters that occur in the line of text that the user input together with the number of times each letter occurs in the line. You should assume: the line has a period at the end of it that you may use to determine the end of input the line has no more than 80 characters (including spaces and other special characters) in it See the code snippet at the end of this assignment for a way of converting System::String things (that will be returned by Console::ReadLine) into arrays of characters. the text can be entered in upper and lower case, but occurrence of a given letter “counts” whether it appears upper or lower case the output should display the letters used in order with most frequently used first. Within frequency of occurrence, letters should appear in alphabetical order – for example: - if the input text was Able was I ere I saw Albania. - the output should be: Letter Number of Occurrences a 6 b 2 e 3 i 3 l 2 s 2 w 2 n 1 r 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Suggestion: Consider using two arrays – one to hold the letters used and one to hold integers. You can organize your solution so that if, for example, letter[8] contains the letter x then times[8] contains the number of times the letter x occurred in the input text line. Then your program can sort the two arrays (in a coordinated fashion) so that they are ordered according to the values in the
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/30/2008 for the course EE 361 taught by Professor Conry during the Spring '08 term at Clarkson University .

### Page1 / 5

HW2 - EE 361 Spring 2008 Homework 2 Due Monday Be sure to keep track of and report in the comment section at the beginning of your homework

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online