Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that prints the message, Hello, my name is Hal! Then, on a new line, the program should print the message What

  image text in transcribed 

Write a program that prints the message, "Hello, my name is Hal!" Then, on a new line, the program should print the message "What would you like me to do?" Then it's the user's turn to type in an input. You haven't yet learned how to do it-just use the following lines of code: string user input; getline(cin, user input); Finally, the program should ignore the user input and print the message "I am sorry, I cannot do that." This program uses the string data type. To access this feature, you must place the line #include before the main function. Here is a typical program run. The user input is printed in color. Hello, my name is Hal! What would you like me to do? Clean up my room I am sorry, I cannot do that. When running the program, remember to press the Enter key after typing the last word of the input line.

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_2

Step: 3

blur-text-image_3

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

13th edition

1439078106, 111197375X, 9781439078105, 9781111973759, 978-1439078099

More Books

Students also viewed these Finance questions