Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Warm up: Variables, input, and casting (1) Prompt the user to input an integer, a double, a character, and a string, storing each into separate

Warm up: Variables, input, and casting

(1) Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space. (2 pts) Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs.

Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 99 3.77 z Howdy 

(2) Extend to also output in reverse. (1 pt)

Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 

(3) Extend to cast the double to an integer, and output that integer. (2 pts)

Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 3.77 cast to an integer is 3

It is the template which you should follow:

#include #include // Supports use of "string" data type using namespace std;

int main() { int userInt; double userDouble; // FIXME: Define char and string variables cout > userInt; // FIXME (1): Finish reading other items into variables, then output the four values on a single line separated by a space // FIXME (2): Output the four values in reverse // FIXME (3): Cast the double to an integer, and output that integer return 0; }

Result should be like that:

image text in transcribed

Enter integer: 99 Enter double: 3.77 Enter character: z Enter string: Howdy 993.77 z Howdy Howdy z 3.7799 3.77 cast to an integer is 3

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

Which companys ratios match Column A?

Answered: 1 week ago

Question

Which companys ratios match Column G?

Answered: 1 week ago