Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: C++ a) Use scanf function to accept the input from the user. b) Use floating point inputs wherever possible. c) Provide the output 1.

image text in transcribed

Instructions: C++ a) Use scanf function to accept the input from the user. b) Use floating point inputs wherever possible. c) Provide the output 1. a) Define a structure with the tag Consumption to consist of a character array (city[20]), an integer (year), and a double (usage). b) Define a structure with the tag Resource to consist of two character arrays (material [30], and units [20]), and three doubles (longitude, latitude, and quantity). Then in the main function, declare metal and fuel to be variables of type struct Resource, and then declare water and power to be variables of type struct Consumption. Declare one more variable wood of type struct Resource with the members of wood to be initialized as per Table I: TABLE I. Member for structure variable wood Value material[30] Oak longitude 32.5 latitude 13.2 quantity 5e+8 5e+8 units[20] hectares Then, use the dot operator (.) or special string functions (wherever applicable) to assign the following values to the members of the various structure variables as per Table II. TABLE II. Variable name Member name Value longitude 57.3 latitude 32.1 metal quantity 3e+10 material Iron units cubic meters Then use the printf() function to print all these numerical values using their respective data type placeholders. Finally, use the scanf() function to input numerical values from the user regarding the values of the following members (a) fuel (b) water (c) power Then print these values which were given as input by the user using the printf() function. [Note: When you use special string functions, you have to use the #include

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

How do books become world of wonder?

Answered: 1 week ago

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago