Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Language : C++ In your program, define a union with the following members: Type Name Description char ch (char is 1 byte) short s

Programming Language : C++

In your program, define a union with the following members:

Type Name Description

char ch (char is 1 byte) short s (short is 2 bytes) int i (int is 4 bytes) float f (float is 4 bytes) double d (double is 8 bytes)

3. Your program should perform the following 5 operations:

A. Set all of the members of the union to 0. Insert the character 'A' into the member ch. Display all 5 members on the console. B. Set all of the members of the union to 0. Insert the number 32,767 into the member s. Display all 5 members on the console. C. Set all of the members of the union to 0. Insert the character 2,147,483,647 into the member i. Display all 5 members on the console. D. Set all of the members of the union to 0. Insert the character 999.999 into the member f. Display all 5 members on the console. E. Set all of the members of the union to 0. Insert the character 999.999 into the member d. Display all 5 members on the console.

There is no need to format the values, just dump them to the console. Display a title for each data block, a label for each member and insert spaces between each output block so that the output makes sense.

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions