Question
Hello, can someone help Take a look at the attached file structConversion.c . Use the following struct template named Person in the program. Modify the
Hello, can someone help
Take a look at the attached file structConversion.c.
Use the following struct template named Person in the program. Modify the following two functions as follows.
void printData(struct person x); struct person readData(); Replace gets with fgets.
You can use any additional helper functions. Submit the complete file as structConversionLab5.c file.
here is the code "
#include
#include
void readData(char name[], char ssn[], int* age, float *height, float *weight){
char buff[BUFSIZ];
gets(name);
gets(ssn);
*age = atoi(gets(buff));
*height = atof(gets(buff));
*weight = atof(gets(buff));
}
void printData(char name[], char ssn[], int age, float height, float weight){
printf("%s %s Age = %d Height(cm) = %g Weight(kg) = %g ", name, ssn, age, height, weight);
}
int main(){
char name[BUFSIZ];
char ssn[BUFSIZ];
int age;
float height;
float weight;
printf("Reading data ...... ");
readData(name, ssn, &age, &height, &weight);
printf(" ");
printf("Printing data .... ");
printData(name, ssn, age, height, weight);
return 0;
}"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started