Hello Everyone,
This question is quite hard for me to understand it. I have gone this further. your help will be appreciated. The program is used to calculate volumes of tanks.
#include <stdio.h>
#include <stdlib.h>
#define PI 3.14152
/*Declare for storing the data of a cylindrical tank
new structure type named TANK with real-valued components
Diameter and height*/
typedef struct Tank{
float Diameter;
float Height;
} TANK;
/*Diameter and height of a tank should be read from the keyboard.
complete the stated C function named
inputTank that reads the diameter and height of real-valued, in a
Structure variables of type TANK stores and returns it*/
TANK inputTank();
??? inputTank()
{
Tank t;
printf("\nPlease Enter the data of the Tank...\n");
printf("Diameter (m):\t");
scanf("%f",&t.diameter);
printf("Height (m):\t\t");
scanf("%f",&t.height);
???;
}
/*The volume of a cylindrical tank with diameter d and height h
is calculated according to the formula V = π * d2 * h / 4. Create a function called getVolume,
leading to a transferred structure variables of type TANK the real-valued volume
calculates and returns as Given in prototype below */
float getVolume(TANK);
float getVolume()
{
float Volume;
Volume= PI * TANK.diameter * TANK.diameter * TANK.height/4;
return Volume;
}
/* Define a field called tanks with 10 elements of type TANK!*/
/* Read the data of the 10 tanks (height and diameter) of the field
tank using the function called input tank from the above function inputTank
one at a time from the keyboard*/
/* Calculate the volume for each tank the respective volume using the
Function called getVolume and print it together with the number of the tanks, starting with one (1, 2, 3 ... 10)
on the Screen! Calculate further the sum total of all
Volumes and print it finally (as "Total") on the screen*/
int main(void)
{
???tanks???;
float sum, volume;
int i;
/*Input of the individual tanks*/
for(???) {
???;
}
printf("\nTabelle aller Tank-Volumen:\n"); /*List of the tank volume*/
to be filed;
for(???) {
???;
printf("Tank %i:\t",???);
printf("%.1f m^3\n",???);
sum ???;
}
printf("\nTotal: %.1f m^3\n",???); /*Total sum of volumes*/
return 0;
}