Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Declare a struct named PatientData that contains two integer data members named

ID: 3854136 • Letter: D

Question

Declare a struct named PatientData that contains two integer data members named heightInches and weightPounds. Sample output for the given program:

Patient data: 63 in, 115 lbs

#include <iostream>
using namespace std;

/* Your solution goes here */

int main() {
PatientData lunaLovegood;

lunaLovegood.heightInches = 63;
lunaLovegood.weightPounds = 115;

cout << "Patient data: "
<< lunaLovegood.heightInches << " in, "
<< lunaLovegood.weightPounds << " lbs" << endl;

return 0;
}

Explanation / Answer

#include <iostream>
using namespace std;

/* Your solution goes here */
struct PatientData{
int heightInches;
int weightPounds;
};

int main() {
PatientData lunaLovegood;
lunaLovegood.heightInches = 63;
lunaLovegood.weightPounds = 115;
cout << "Patient data: "
<< lunaLovegood.heightInches << " in, "
<< lunaLovegood.weightPounds << " lbs" << endl;
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote