1answer.
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
Romashka [77]
4 years ago
15

What is the output of the following C++ program?

Computers and Technology
1 answer:
KIM [24]4 years ago
3 0

Answer:

Output:<em> </em><em>15 11/16 inches</em>

Explanation:

#include <iostream>

using namespace std;

////////////////////////////////////////////////////////////////////////

class InchSize {

public:

   InchSize(int wholeInches = 0, int sixteenths = 0);

   void Print() const;

   InchSize operator+(InchSize rhs);

   

private:

   int inches;

   int sixteenths;

};

InchSize InchSize::operator+(InchSize rhs) {

   InchSize totalSize;

   totalSize.inches = inches + rhs.inches;

   totalSize.sixteenths = sixteenths + rhs.sixteenths;

   

   // If sixteenths is greater than an inch, carry 1 to inches.

   if (totalSize.sixteenths >= 16) {

       totalSize.inches += 1;

       totalSize.sixteenths -= 16;

   }

   return totalSize;

}

InchSize::InchSize(int wholeInches, int sixteenthsOfInch) {

   inches = wholeInches;

   sixteenths = sixteenthsOfInch;

}

void InchSize::Print() const {

   cout<<inches<<" "<<sixteenths<<"/16 inches"<<endl;

}

////////////////////////////////////////////////////////////////////////

int main() {

   InchSize size1(5, 13);

   InchSize size2(9, 14);

   InchSize sumSize;

   sumSize = size1 + size2;

   sumSize.Print();

   return 0;

}

////////////////////////////////////////////////////////////////////////

sumSize variable was printed in the end. Print() prints the calling object's inches and sixteenths variables' values.

sumSize's inches is equal to size1 plus size2's inches.

Because the sum of sixteenths was greater than 16, sumSize's sixteenth was decreased by 1 and inches was increased by 1.

You might be interested in
How to clear cache in Internet Explorer Version 11
Paladinen [302]
Clear the browser history and accept everything
7 0
4 years ago
Read 2 more answers
Mainframe computers have several CPUs, have very fast processor speeds, can supporting multiple operating systems and have huge
Marrrta [24]

Answer:

True.

Explanation:

Mainframe computers were developed and introduced in the early 1950s.

Mainframe computers have several CPUs, have very fast processor speeds, can supporting multiple operating systems and have huge amounts of storage capacity. As a result, mainframe computers are mostly or commonly used by large companies, business firms or governmental institutions for performing various complex tasks such as census, financial transactions, e-commerce, data sequencing, enterprise resource planning, etc.

7 0
3 years ago
Sophisticated modeling software is helping international researchers (1 point) create more intricate screenplays and movie scrip
tatiyna

Answer: Increase the pace of research in finding and producing vaccines.

Explanation: The modelling software is the software that is used by the international researchers for the purpose of the researching about the vaccines. There are diseases which still don't have any vaccines and they create serious health conditions.

So, researchers are investigating and trying to develop the vaccines with increasing pace.Other options are incorrect because researchers are not looking for the movie scripts, marketing products and evidences.

8 0
4 years ago
Daphne used to work in the city where she would take public transportation to work. However, she just took a new job in the subu
mr Goodwill [35]

Answer:

A need

Explanation:

Daphne has no choice but to get a car and a house immediately, she relocates. Anything that is a choice and gives you the desire to acquire it, but cannot, due to one reason or the other, is a want. A need, on the hand, is something that Daphne should have to survive. She will need a car and a house to stay alive and will obviously not do anything without them. A home and a car are physical needs that can be touched or measured while aspects like happiness and good health are subjective needs that we need as humans to survive.

4 0
3 years ago
Hey can someone help?
Zinaida [17]
Send an email to it!
4 0
3 years ago
Read 2 more answers
Other questions:
  • Austin works as a department head and frequently uses presentations to deliver information to his staff. He relies heavily on pr
    5·2 answers
  • Which of the following is a Microsoft solution that runs on a Microsoft Terminal Services server but appears, to end users, as i
    10·1 answer
  • Okay I need help. In the first picture, the black glasses, that was my vision last year 52:17 135 and my vision now is 52:15 135
    5·1 answer
  • 3. What is the purpose of the conclusion in an expository essay? (1 point)
    8·2 answers
  • If you can log into a website to add, edit, or delete content that has been added by you or another user, you are most likely us
    6·1 answer
  • Which of the following is considered a benefit of using simulation programs? a. They allow users to experience potentially dange
    10·1 answer
  • True or false Encryption prevents hackers from hacking data?
    8·1 answer
  • Describe what impact your personal vision could have your community or on society​
    6·1 answer
  • _____is used to organize and modify the properties of the current selection.
    6·1 answer
  • Identify suitable hardware components that will meet your requirements. Be reasonably specific. For example:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!