(Solved) : Would Able Help Get Working Need Add Code Make Calculate Volume Cylinder Calculate Mass Cy Q43994792 . . .
would you be able to help me get this working? i need toadd on to the code i have now to make it calculate the volume of acylinder. calculate the mass of the cylinder. this is theformatting we need to use which im having troubles doing thanks tothe fgets command we need to use.
the code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define _CRT_SECURE_NO_WARNINGS
/*******************************************************************************
LAB 2: Using Functions
********************************************************************************
Developed by:
Date: Jan 14, 2020
********************************************************************************
Description:
*******************************************************************************/
//Function prototype
void purpose();
void GetName(char FnName[]);
void GetFloat(char Radius[], char Height[], char Density[]);
float Volume(float volume);
/*******************************************************************************
Main
*******************************************************************************/
void main()
{
//Variable Declarations/user inputs
purpose(); //print the message
char FName[11] = “first”;
char LName[11] = “last”;
char Radius[11] = “radius”;
char Height[11] = “height”;
char Density[11] = “density”;
GetName(FName);
GetName(LName);
GetFloat(Radius, Height, Density);
while (!_kbhit()); //keeps window open untilkeybored is pressed.
}
/*******************************************************************************
Purpose – This function prints the purpose of the program to theconsole.
Inputs: none
Returned: none
*******************************************************************************/
void purpose(void)
{
printf(“nThis program will ask for the users firstname and last name “);
printf(“nand tell you how many letters are in yourname. “);
}
/*******************************************************************************
GetName – This function requests the Name of the user and returnsit to the
calling function.
Inputs: none
Returned: A Character value
*******************************************************************************/
void GetName(char FnName[])
{
//First Name
printf(“nPlease enter your %s name: “, FnName);
fflush(stdin);
fgets(FnName, 11, stdin);
}
/*******************************************************************************
GetFloat –
Inputs: none
Returned: The Integer given from user (int)
*******************************************************************************/
void GetFloat(char Radius[], char Height[], char Density[])
{
//Gets the radius from user
printf(“nplease enter %s in meters (m): “,Radius);
fflush(stdin);
fgets(Radius, 11, stdin);
//Gets Height from user
printf(“nplease enter %s in meters (m): “,Height);
fflush(stdin);
fgets(Height, 11, stdin);
//gets density from user
printf(“nplease enter %s in kg/m^3: “,Density);
fflush(stdin);
fgets(Density, 11, stdin);
}
/******************************************************************************
Volume
******************************************************************************/
//float Volume(float volume)
//{
//calculations
//volume = (char radius * char Height);
//}
user_first name user last name, there are X letters in your first name and X letters in your last name. Based on the cylinder dimensions and fluid density you entered, height = x.XX m, radius = X.Xx m, density = X.XX kg/m^3, %3D %3D volume = X.X m^3 and mass X.X kg, when full. %3D %3D Show transcribed image text user_first name user last name, there are X letters in your first name and X letters in your last name. Based on the cylinder dimensions and fluid density you entered, height = x.XX m, radius = X.Xx m, density = X.XX kg/m^3, %3D %3D volume = X.X m^3 and mass X.X kg, when full. %3D %3D
Expert Answer
Answer to would you be able to help me get this working? i need to add on to the code i have now to make it calculate the volume o…
OR