subject

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

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
The isometric projection camera technique provides an illusion of perspective by using things like parallax scrolling to create the illusion of 3d in a 2d game
Answers: 3
question
Computers and Technology, 22.06.2019 21:30
Elements such as fonts colors visual structure graphics and the interface of a web page should complement each other to ensure blank
Answers: 3
question
Computers and Technology, 23.06.2019 04:40
The narrative structure of the popular movies can be broken down into
Answers: 3
question
Computers and Technology, 23.06.2019 10:50
Your friend kayla is starting her own business and asks you whether she should set it up as a p2p network or as a client-server network. list three questions you might ask to kayla decide which network to use and how her answers to those questions would affect your recommendation.
Answers: 2
You know the right answer?
What is the output of the following C++ program?

#include
using namespace std;
Questions
question
Biology, 22.07.2019 02:01
question
Computers and Technology, 22.07.2019 02:01
Questions on the website: 13722360