We appreciate your visit to 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. This page offers clear insights and highlights the essential aspects of the topic. Our goal is to provide a helpful and engaging learning experience. Explore the content and find the answers you need!

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
```

```cpp
#include
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;
}
```

Answer :

Final answer:

In C++, the keyword 'struct' defines a structure. Here, the 'PatientData' structure is defined with the integer members 'heightInches' and 'weightPounds'. The object 'lunaLovegood' accesses these members using a dot operator.

Explanation:

In the language of C++, struct is used as a keyword to define a structure. Here, you have been asked to declare a structure named PatientData which will contain two integer data members named heightInches and weightPounds. Here is how you can do it: struct PatientData { int heightInches;int weightPounds;};

In the structure PatientData, heightInches and weightPounds are the members of the structure and has been declared as int. So, the variables heightInches and weightPounds will only hold integer values. Here,

lunaLovegood is an object of the structure PatientData and can access the members of structure using dot operator.

Learn more about struct in C++ here:

https://brainly.com/question/33329444

#SPJ3

Thanks for taking the time to read 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. We hope the insights shared have been valuable and enhanced your understanding of the topic. Don�t hesitate to browse our website for more informative and engaging content!

Rewritten by : Barada

Answer:

struct PatientData{

int heightInches, weightPounds;

};

Explanation:

In order to declare the required struct in the question, you need to type the keyword struct, then the name of the struct - PatientData, opening curly brace, data members - int heightInches, weightPounds;, closing curly brace and a semicolon at the end.

Note that since the object - lunaLovegood, is declared in the main function, we do not need to declare it in the struct. However, if it was not declared in the main, then we would need to write lunaLovegood between the closing curly brace and the semicolon.