1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jeka94
2 years ago
7

Create union floatingPoint with members float f, double d and long double x. Write a program that inputs values of type float, d

ouble and long double and stores the values in union variables of type union floatingPoint. Each union variable should be printed as a float, a double and a long double. Do the values always print correcly? Note The long double result will vary depending on the system (Windows, Linux, MAC) you use. So do not be concern if you are not getting the correct answer. Input must be same for all cases for comparison Enter data for type float:234.567 Breakdown of the element in the union float 234.567001 double 0.00000O long double 0.G0OO00 Breaklo n 1n heX float e000000O double 436a9127 long double 22fde0 Enter data for type double :234.567 Breakdown of the element in the union float -788598326743269380.00OGOO double 234.567000 long double 0.G00000 Breakolon 1n heX float 0 double dd2f1aa0 long double 22fde0 Enter data for type long double:
Computers and Technology
1 answer:
Kitty [74]2 years ago
5 0

Answer:

Here the code is given as follows,

#include <stdio.h>

#include <stdlib.h>

union floatingPoint {

float floatNum;

double doubleNum;

long double longDoubleNum;

};

int main() {

union floatingPoint f;

printf("Enter data for type float: ");

scanf("%f", &f.floatNum);

printf("\nfloat %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

printf("\n\nEnter data for type double: ");

scanf("%lf", &f.doubleNum);

printf("float %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

printf("\n\nEnter data for type long double: ");

scanf("%Lf", &f.longDoubleNum);

printf("float %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

return 0;

}

You might be interested in
By default the normal style inserts a vertical space equal to _____ lines between each line of text
nika2105 [10]
By default the normal style inserts a vertical space equal to 1.5 size vertical   lines between each line of text.
3 0
2 years ago
write a java program using a do while loop to prompt the user to enter a password. The user should be prompted to enter the pass
Alex787 [66]
We can import Scanner from Java.utils.Scanner to pull in text entered in the console.

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String password = "";
do {
System.out.print("Enter your password: ");
password = sc.nextLine();
if(!password.equals("pals") {
System.out.println(\nIncorrect Password. Try again.");
}
} while(!password.equals("pals");
3 0
3 years ago
A(n) _____ is created using the select and option elements that present users with a group of predefined possible values for the
aniked [119]

Answer:

c. selection list.

Explanation:

A selection list is created using the select and option elements that present users with a group of predefined possible values for the data field.

In Computer programming, the selection list is used to avail the end users with the ability to engage in an operation such as a predefined possible values for the data field.

7 0
2 years ago
One line of code is missing (marked in
Harman [31]

Answer: num1.plus(1);

Explanation:

4 0
2 years ago
About "How can computer help us in our life?​
Nitella [24]

Answer:

Explanation:

Computer also facilitate comfort to our life and provides convenience. For transportation, it facilitate the way people travel. Airways, Roadways and waterways uses computers to control their operation. It saves time and relieve severity of traveling difficulties.

6 0
2 years ago
Other questions:
  • What operating system was most commonly used by early personal computers? Apple Mac MS-DOS Windows
    6·2 answers
  • What will happen with communication methods in five years?
    8·1 answer
  • What natural resources fueled industrialization in the united states?
    14·1 answer
  • The syntax used for referencing cells with their worksheet names is the sheet name, followed by ____, then the usual column lett
    8·1 answer
  • Prompt the user ‘Enter a row vector of any numbers’ in the command window, and enter an arbitrary row vector and store it to x.
    6·1 answer
  • To rename a database object, press and hold or right-click the object in the navigation pane and then tap or click ____ on the s
    10·1 answer
  • 3. The term integration refers to the ability to
    6·1 answer
  • What would be the best engine to use for making a 3d beginner game
    9·1 answer
  • Kylee needs to ensure that if a particular client sends her an email while she is on vacation, the email is forwarded to a cowor
    7·1 answer
  • Write a function called mul_time that takes a Time_Elapsed object and a number and returns a new Time_Elapsed object that contai
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!