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]
3 years ago
15

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

Computers and Technology
1 answer:
KIM [24]3 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
Which item is essential to know before sketching a navigation menu flowchart?
alisha [4.7K]

Answer:

A, template specifics, such as horizontal or vertical menu layout

Explanation:

4 0
2 years ago
Read 2 more answers
Who was one of the founders of the location sharing site Foursquare​
Shalnov [3]

One of the founders of Foursquare is Dennis Crowley. The other is Naveen Selvadurai. I know you didn't ask for both but I wanted to give them to you just in case. I hope this helps! (:

7 0
2 years ago
How did The Gates by Christo and Jeanne-Claude affect the site?
Nadusha1986 [10]

Answer:

C. The experience of the park with The Gates was so different that some people saw the park in a new way.

Explanation:

The couple, Christo Javacheff and Jeanne-Claude Denat based in New York were two top contemporary artists who formed collaborative arts.

On the 3rd of January, 2005 they both made an art work known as The Gates, in Central Park.

The experience of the park with "The Gates" was so different that some people saw the park in a new way.

8 0
3 years ago
Read 2 more answers
On tool hackers use to get sensitive information from victims is/are:
Feliz [49]
Pretty sure it’s keyloggers because it’s the only one that makes sense to me but I’m not 100% sure on that one
5 0
3 years ago
Read 2 more answers
Sarah has to add a picture from her computer file and add a caption to it. Arrange the steps in a correct sequence.
MatroZZZ [7]

Answer:

-Click insert

-Click picture

-Click from file

-Right click the picture

-Select the desired picture and again click Insert

-Click insert caption

-Write the caption and add it

Explanation:

6 0
2 years ago
Other questions:
  • Write a MIPS program to continuously generate the following series of integers: 1, 2, 3, 6, 9, 18, 27, 54, 81, and so on. Use st
    13·1 answer
  • If a gas gosts 3.60 per gallon how much doe sit cost to drive 500 miles in the city
    5·1 answer
  • list the network characteristics of the wireless network(s) in the decode -- SSIDs, channels used, AP names, presence of Bluetoo
    6·1 answer
  • An effectively distributed resume will get an interview
    12·2 answers
  • Integrated circuits are made up of _____ and carry an electrical current
    14·1 answer
  • ALGUEM SABE COMO MUDA O NOME DE PERFIL!?!?!? SE SOUBER ME AJUDA!!
    14·1 answer
  • Write a program that receives an character and displays its Unicode. Here is a sample run: Enter an character: E The Unicode for
    8·1 answer
  • Why is Linux widespread in academic environments?
    7·1 answer
  • 7 TH GRADE QUESTION...PLS HELP
    12·2 answers
  • For computer forensics, ____________ is the task of collecting digital evidence from electronic media.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!