1. Engineering
  2. Computer Science
  3. 1 declare a structure named tempscale with the following...

Question: 1 declare a structure named tempscale with the following...

Question details

1) Declare a structure named TempScale , with the following members:

fahrenheit: a double

centigrade: a double

Next, declare a structure named Reading , with the

following members:

windSpeed: an int

humidity: a double

temperature: a TempScale str ucture variable

Next define a Reading structure variable.

------------------------------------------------------------

2) Write statements that will store the following data in

the variable you defined in Problem 1:

Wind Speed: 37 mph

Humidity: 32%

Fahrenheit temperature: 32 degrees

Centigrade temperature: 0 degrees

------------------------------------------------------------

3) Write a function called showReading. It should accept a Reading

structure variable (Prob #1) as its argument.

The function should display the contents of the

variable on the screen.

------------------------------------------------------------

4) Write a function called findReading. It should use a

Reading structure reference variable (Prob # 1) as its

parameter. The function should ask the user to enter

values for each member of the structure.

------------------------------------------------------------

5) Write a function called getReading , which returns a

Reading structure (Prob #1). The function should ask

the user to enter values for each member of a Reading

structure, then return the structure.

------------------------------------------------------------

6) Write a function called recordReading . It should use a

Reading structure pointervariable (Prob #1) as its

parameter. The function should ask the user to enter

values for each member of the structure pointed to

by the parameter.

------------------------------------------------------------

7) Rewrite the following statement using the structure

pointer operator:(*rptr).windSpeed = 50;

------------------------------------------------------------

8) Rewrite the following statement using the structure

pointer(arrow)operator: *(*strPtr).num = 10;

------------------------------------------------------------

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution