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
Def sum_divisors(n): sum =1 # Return the sum of all divisors of n, not including n x=int(n**0.5) for i in range(2,(x//1)+1): if
Novosadov [1.4K]

Answer:

This is a python program that counts the number of divisors of a given number and calculates the sum of the divisors.

Explanation:

The first line defines a function "sum_divisors" with an argument "n". The square root of the argument is converted to integer and assigned to the variable "x", then a for loop is used to iterate through the range 2 to the calculated nth number of divisors in the argument.The return keyword returns the sum value.

The function is called with several arguments and printed with the print function.

6 0
2 years ago
Explain the difference between using the int type and the double type for numbers.
MaRussiya [10]
They have different semantics, <span>addition to having different semantics from </span>double<span>, </span>int<span> arithmetic is generally faster, and the smaller size (32 bits vs. 64 bits) leads to more efficient use of caches and data transfer bandwidth.....
Did That Help You In Anyway </span>
6 0
3 years ago
When Kristy recently started a photography business, she downloaded Photoshop to her computer to edit her photos. She notices he
Evgesh-ka [11]

Answer: A. System window and C. System Information window

Explanation:

Hi, RAM stands for Random Access Memory. RAM stores information about running programs in your computer, as long the computer is on.

To know how much RAM is installed on a system you can use the system window tool.

In windows 10 Right click on "Start Menu" and click on "System" in pop-up menu to open "System" window.

System window will show basic information of the computer, including the amount of RAM installed.

Also you can Type "System Information" in the search box, and select "System Information" from search results.

"System Information" window shows a more detailed system summary, of hardware resources and devices. Incluiding RAM.

Feel free to ask for more if needed or if you did not understand something.

7 0
3 years ago
An information system should collect data from both external and internal sources, although organizational objectives and the ty
Andrews [41]

Answer:

True

Explanation:

An information system is the information and communication technology (ICT) that an organization uses, and also the way in which people interact with this technology in support of business processes. It is an integrated set of components for collecting, storing, and processing data and for providing information, knowledge, and digital products.

6 0
3 years ago
In 1981, Ian Murphy broke into the AT&amp;T online computer system and changed their clocks, allowing people to make calls durin
poizon [28]
A. intentionally or recklessly disrupt, degrade, or destroy information or services on the computer
5 0
2 years ago
Other questions:
  • Pinterest is most useful for?
    10·2 answers
  • Anicius boethius invented a system that made possible the memorization and written transmission of melodies.
    9·1 answer
  • The smallest building block of a wireless lan is a ______.
    5·1 answer
  • What will the following segment of code output?
    7·1 answer
  • Define a function called 'findWordFreq, which takes two parameters. The first parameter, 'text" is an nltk.text.Text object and
    8·1 answer
  • The best way to help prevent a system from a worm attack is to use anti-virus software anti-malware software a firewall a router
    12·1 answer
  • Write a program with a function that accepts a string as an argument and returns the number of uppercase, lowercase, vowel, cons
    14·1 answer
  • Giving 5 stars, a Thanks, 80 points, and Branliest to whoever answers them correctly.
    9·1 answer
  • I need help about computer program. Solve C language code...... please​
    7·1 answer
  • Which of the following is an antivirus software?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!