Question: 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
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 of a cylinder. calculate the mass of the cylinder. this is the formatting we need to use which im having troubles doing thanks to the fgets command we need to use.

the code:
#include
#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 until keybored is pressed.
}
/******************************************************************************* Purpose - This function prints the purpose of the program to the console.
Inputs: none
Returned: none *******************************************************************************/ void purpose(void) { printf(" This program will ask for the users first name and last name "); printf(" and tell you how many letters are in your name. "); } /******************************************************************************* GetName - This function requests the Name of the user and returns it to the calling function.
Inputs: none
Returned: A Character value *******************************************************************************/ void GetName(char FnName[]) { //First Name printf(" Please 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(" please enter %s in meters (m): ", Radius); fflush(stdin); fgets(Radius, 11, stdin);
//Gets Height from user printf(" please enter %s in meters (m): ", Height); fflush(stdin); fgets(Height, 11, stdin);
//gets density from user printf(" please 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
