Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. Problem 1:
  2. Create a file called words.txt and type a bunch of sentences into it. Write a program to read this file and display the contents of it using print
  3.  
  4. Problem 2:
  5. Modify the program in the previous problem to use a regular expression to only display words that are followed by a period
  6.  
  7. Problem 3:
  8. Modify the program to read in words that are followed by a period, remove the period, and put them in an array. Print the array.
  9.  
  10. Problem 4:
  11. Modify the program to sort the array into alphabetical order and print the array
  12.  
  13. Problem 5:
  14. Create a class in your program to store information on the sentence. This class should have one private member that is the string containing the sentence, and public functions to initialize the class, output the first word, the last word, and the number of words. Print out the last word in each sentence in alphabetical order followed by the first word and the number of words and a newline character.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement