Question: 1. Design and write a program that will accept a sentence as input, reverse the words and print the sentence out backwards. Ex: The movie
1. Design and write a program that will accept a sentence as input, reverse the words and print the sentence out backwards.
Ex: The movie was not very true to the book. Output: book the to true very not was movie The(NOTE: You may keep the period after book if you want to.)
2. Suppose that you have the following string which is a time stamp from a data file. 2011-117T08:40:56.9368Z (NOTE: You will have to type this in for it to be in the input buffer.)
The string shows the date 2011, the orbit number 117 and the time asT08:40:56.9368Z. Using only cin.get, cin.ignore, cin.putback and cin.peek extract the time from the input buffer and print it as follows:
8 Hours 40 Minutes 56 Seconds
You can ignore the .9368Z part.
Leave all other data in the input buffer such that after the time is extracted and printed the input buffer contains2011-117T.9368Z.You can use getline to get the remainingdata in the input buffer and then print it to the screen.
3. Write a program that will convert a string of binary digits to the decimal equivalent. For convenience limit the binary number to 16 bits. Write the decimal equivalent to the screen. Here are some examples:
BINARY DECIMAL
111 7
01000000000 1024
100100101 549
HINT: Read the binary number as a string type. The ASCII value for the number "1" is 49. An easy way to convert the ASCII to an integer is to subtract 48. e.g. bit = (digit - 48) wher bit is of type int.
File Input
The following problems require the file dictionary_four_letter_words.txt.
4. Spell check. Given a string of four consecutive characters input by the user determine if it is a word. Your program should allow the user to input as many words as they want one at a time. (NOTE: You may use the program we did in class as a starting point. See the "Solutions to in Class Examples page on Canvas.)
5. Using the dictionary of four letter words print out (to the screen) all words that are palindromes. (Words that are the same forward and reverse like peep, and noon.) (NOTE: You can combine this with program 4 if you like.)
6. Given the word find puzzle below locate and print out all four letter words. The words can appear in their normal form or reversed. There are no vertical or diagonal words yet.Process one line at a time.
You can download the puzzle in lower case from this link. (Here is a file in lowercase.)
PXABACKEGS ESORELATED VMOONKCENT ZRLLABLEAD MSRKRADMCF FLOORTJUKV STRXMICEDC QUTAMKTSUD RXQUITMMUY DATASETLAS
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
