answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
il63 [147K]
2 years ago
13

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 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;}
Computers and Technology
1 answer:
boyakko [2]2 years ago
8 0

Answer:

struct PatientData{

   int heightInches, weightPounds;

};

Explanation:

In order to declare the required struct in the question, you need to type the keyword <em>struct</em>, then the name of the struct - <em>PatientData</em>, <em>opening curly brace</em>, data members - <em>int heightInches, weightPounds;</em>, <em>closing curly brace</em> and <em>a semicolon</em> 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 <em>lunaLovegood</em> between the closing curly brace and the semicolon.

You might be interested in
Exercise 4: Bring in program grades.cpp and grades.txt from the Lab 10 folder. Fill in the code in bold so that the data is prop
Alex73 [517]

Answer:

Here is the C++ program:

#include <fstream>  //to create, write and read a file

#include <iostream>  // to use input output functions

using namespace std;  //to access objects like cin cout

const int MAXNAME = 20;  //MAXNAME is set to 20 as a constant

int main(){  //start of main() function

ifstream inData;  //creates an object of ifstream class

inData.open("grades.txt");  //uses that object to access and opens the text file using open() method

char name[MAXNAME + 1];   // holds the names

float average;   //stores the average

inData.get(name,MAXNAME+1);  //Extracts names characters from the file and stores them as a c-string until MAXNAME+1 characters have been extracted

while (inData){  //iterates through the file

 inData >> average;  //reads averages from file using the stream extraction operator

 cout << name << " has a(n) " << average << " average." << endl; //prints the names along with their averages

 inData.ignore(50,'\n');  //ignores 50 characters and resumes when  new line character is reached. It is used to clear characters from input buffer

 inData.get(name,MAXNAME+1);}  //keeps extracting names from file

return 0; }

Explanation:  

The program is well explained in the comments added to each line of the code. The program uses fstream object inData to access the grades.txt file. It gets and extracts the contents of the file using get() method, reads and extracts averages from file using the stream extraction operator. Then program displays the names along with their averages from grades.txt on output screen.

The grades.txt file, program and its output is attached.

3 0
2 years ago
A natural language processor reads the sentence The walk was tiring and mistakes the noun “walk” as a verb. What is such an erro
Ray Of Light [21]

Answer: Which of these is a compound morphology? (A. bookkeeper = book + keeper)

The software first uses (NLU) to map and analyze the input. It then creates the output using (NLG).

(It works by mapping input to representation and analyzing them.)

What type of morphology does this follow? (D. derivational morphology)

What is such an error called? (C. lexical ambiguity)

Explanation: Plato

4 0
2 years ago
Your computer has gradually slowed down. What's the most likely reason?
sweet-ann [11.9K]
It could be old ... could be your connection to the internet... could be a virus. You can go to walmart or your super store and buy a usb for your computer. There are ones that can speed up your computer. I had to buy it for mine and it worked. It might be over 20 dollars depends on where you go.
8 0
2 years ago
Which of the following statements is true? Using existing exceptions makes the program less robust. Always create your own excep
hjlf

Answer:

The third option is correct.

Explanation:

The following option is true because it's a derived with that Throwable class. More than that exception type, it is also other category called Error originating through that Throwable class. As any other class, the exception class will also include fields as well as functions. So, the following are the reason that describes the following answer is true according to the exception class.

The other options are not appropriate according to the following scenario.

8 0
2 years ago
You’re trying to cast a video presentation from your tablet to a projector for a training session with some new hires. Although
Vikki [24]

Answer:

Troubleshooting steps to take:

  1. Restart the tablet
  2. Restart the projector

Explanation:

When such problems occur, the basic and quick troubleshooting step is to restart the device or devices involved.

  1. Restart the tablet: This could come in handy regarding this problem. The inability to connect to the projector could be due to the inability of a specific service or driver needed for the projector. Restarting the tablet will load up the drivers and services again to enable smooth connections. When a restart is done, bugs are fixed, internet connection is rectified, memory leaks are stopped, performance is aided, the RAM (Random Access Memory) is flushed or cleaned. This should resolve the problem, however, if not, try number 2.
  2. Restart the projector: There are driver software on projectors, and due to one system failure or another, these software may fail to load. This could affect its connection to another device. As done in (1), restarting the projector will fix those bugs and load up, which should solve the connection issue.
7 0
2 years ago
Other questions:
  • "Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that de
    10·1 answer
  • Which of the following facts determines how often a nonroot bridge or switch sends an 802.1D STP Hello BPDU message?
    14·1 answer
  • ________ is a free online service that enables a user to contact a cell phone number to hear who answers the telephone without i
    5·1 answer
  • (a) Show how to use (the Boolean formula satisfiability program) satisfiable num (and substitute) to find a satisfying assignmen
    9·1 answer
  • Write a program that plays a reverse guessing game with the user. The user thinks of a number between 1 and 10, and the computer
    5·1 answer
  • Write a method that will receive 2 numbers as parameters and will return a string containing the pattern based on those two numb
    10·1 answer
  • Dawn needs to insert a macro into a Word document. Where can she find the Insert Macro dialog box?
    11·1 answer
  • It is also called teleconferencing or web conferencing,which is an online meeting wherein two or more people can see,hear,and ta
    14·1 answer
  • Laura is the first person in her SDLC team to detect and predict security vulnerabilities in the software. In which phase is Lau
    11·1 answer
  • Describe how a cell’s content and format attributes are related.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!