Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 as T08: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 contains 2011-117T.9368Z. You can use getline to get the remaining data 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 (Links to an external site.)Links to an external site..)

PXABACKEGS ESORELATED VMOONKCENT ZRLLABLEAD MSRKRADMCF FLOORTJUKV STRXMICEDC QUTAMKTSUD RXQUITMMUY DATASETLAS

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Logistics Lifeline Supply Chain Strategies

Authors: Ehsan Sheroy

1st Edition

7419377502, 978-7419377503

More Books

Students also viewed these Databases questions

Question

c. What groups were least represented? Why do you think this is so?

Answered: 1 week ago