Computers and Technology

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

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:00, Janznznz1121
Your computer running windows 10 is doing some very strange things with the operating system. you are fairly certain it is not a hardware issue. you need to try to get further insight into what is going on within the operating system. which tool would be best suited for this?
Answers: 2
image
Computers and Technology, 22.06.2019 20:00, ksanchez2100
Need asap assignment directions: think of an organization (business, religious institution, volunteer organization, sports team) with which you have been involved. imagine outfitting it with an it infrastructure. prepare a plan for what you would do to support outfitting it. draw a map of a network connecting all the individuals, give them pcs and printers, and lay out the design as best you can. the purpose is to begin working with these concepts, not to build a perfect network.
Answers: 2
image
Computers and Technology, 22.06.2019 22:30, raiapowell
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
image
Computers and Technology, 23.06.2019 10:20, chonawilson4
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
Do you know the correct answer?
What is the output of the following C++ program?

#include
using namespace std;

Questions in other subjects: