Advertisement
Guest User

Untitled

a guest
Jul 17th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. COP3330 Programming Assignment 8
  2. A variation of the UNIX wc utility
  3. Objectives
  4. Practice problem solving using C++
  5. Project details
  6. Your program should read the standard input until it reaches the end, counting the number of times each word/character is used. A word can either be an identifier or a number. An identifier is defined as a letter followed by a sequence of letters or digits('a'..'z', 'A'..'Z', or '0'..'9'). Identifiers are case insensitive ("AA00", "Aa00", "aA00", and "aa00" are the same). A number is defined as a sequence of digits ('0'..'9') that are not in an identifier. Different sequences represent different numbers. For example, number "001" is different from number "1". Identifiers are separated by non-letter and non-digit characters. Numbers are separated by identifiers or non-letter and non-digit characters. Your program should record the number of times each identifier/number/character happens. It should first output the number of lines, words, and characters. After that, it should output the five most used characters, the five most used numbers, and the five most used identifiers as well as the number of times these characters/numbers/identifiers are used. Since identifiers are case insensitive, the program only outputs identifiers with lower case letters. The characters, numbers and identifiers should be outputted in the descending order based on the number of times they are used. When two characters happen the same number of times, the character with a smaller ASCII value should be considered as being used more frequently. When two identifiers (numbers) happen the same number of times, the identifier (number) that occurs earlier in the input should be considered as being used more frequently. An example executable (for the program machines) 'proj8_linprog' is given. You should make the outputs of your program the same as those of 'proj8_linprog'. When printing characters, use '\t' for tab and '\n' for newline. All other letters including invisible ones should be outputted normally.
  7.  
  8. You can assume that the total number of different words used in a file is less than 30000 and the number of characters in a word is less than 100.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement