Answer:
The solution to this question with code explaination is given below in explanation section.
Step-by-step explanation:
#include <iostream>
typedef struct HeightFtIn_struct {// declaring struct for feet and inches
int feet;
int inches;
} HeightFtIn;
HeightFtIn ConvertToFeetAndInches(int totalInches) {// function to convert to feet and in inches from total inches
int inches = totalInches;// declare inches local variable in ConvertToFeetAndInches function.
int feet = inches/12;// convert total inches into feet;
int leftInches = inches%12;// remaining inches after converting total inches into feet
HeightFtIn tempVal;// declare HeightFtIn_struct variable to store the value of inches and feets.
tempVal.feet = feet;// store feet value
tempVal.inches = leftInches;// store remaining inches after converting totalInches into feet
return tempVal;// return feets and inches.
/* Your solution goes here */
}
int main(void) {
HeightFtIn studentHeight; // declare HeightFtIn_struct variable studentHeight;
int totalInches;// declaring totalInches variable.
scanf("%d", &totalInches);// prompt user to enter totalInches;
studentHeight = ConvertToFeetAndInches(totalInches);// ConvertToFeetAndInches
printf("%d feet and %d inches\\", studentHeight.feet, studentHeight.inches);//display converted feet and inches from totalInches;
return 0;
}