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
Ilya [14]
3 years ago
11

C++

Computers and Technology
1 answer:
Nookie1986 [14]3 years ago
7 0

Answer:

Following are the code to the given question:

#include <iostream>//header file

using namespace std;

class Window //defining a class Window

{

private:

int width, height;//defining integer variable

public:

friend ostream& operator << (ostream& stm, Window& width)//defining a friend function that takes two parameters

{

return stm<<"a ("<<width.width<<" x "<<width.height<<") window"; //use return keyword that return its values

}  

Window(int width, int height): width(width), height(height)//defining parameterized constructor that inherit width and height in its parameters  

{}

};

int main() //Main method

{

Window w(80,90);//calling class constructor

cout<<w;//print object value

return 0;

}

Output:

a (80 x 90) window

Explanation:

In the above code, a class "Window" is defined that uses a friend function "ostream& operator" is declared that uses the "ostrea&" as a data type to hold two-variable "stm and w" in its parameter, and declared the parameterized constructor to hold value by inheriting width and height in its parameters.

Inside the main method, a class object is created that calls the constructor and uses the print method to print object value.

You might be interested in
The range of a finite nonempty set of $n$ real numbers $S$ is defined as the difference between the largest and smallest element
-Dominant- [34]

Answer: Hello your question is poorly written attached below is the well written question

answer:

a) Determine ( compute ) the difference between the max and minimum value. determine the Min and max values using 1.5n comparisons

  time efficiency = θ( n )

b) A(n-1) - A(0)

  time efficiency = θ( 1 )

Explanation:

a) An unsorted array

To find the maximum and minimum values scan the array of elements , then determine ( compute ) the difference between the max and minimum value. to determine the range. Alternatively determine the Min and max values using 1.5n comparisons

Algorithm's time efficiency = θ( n )

b) A sorted array

To determine the range, we will determine the difference between the first and last element i.e. A(n-1) - A(0)

time efficiency = θ( 1 )

7 0
2 years ago
Which of the following best explains the different between Cut and Copy? a. When you copy text you are permanently deleting it,
Vilka [71]
B. When you copy text it remains in its original location and places it on the clipboard. Cutting text removes it from its original location and places it on the clipboard

5 0
2 years ago
Read 2 more answers
Can be referred to as a universal network of interrelated computers which delivers a very wide variety of information and commun
nlexa [21]

Answer:

Internet

Explanation:

just took the test and got A

7 0
2 years ago
Given the value x=false ,y=5 and z=1 what will be the value of F=(4%2)+2*Y +6/2 +(z&amp;&amp;x)?
Bezzdna [24]
<h2>Answer:</h2>

F = 13

<h2>Explanation:</h2>

Given:

x = false

y = 5

z = 1

F = (4%2)+2*Y +6/2 +(z&&x)

We solve this arithmetic using the order of precedence:

<em>i. Solve the brackets first</em>

=> (4 % 2)

This means 4 modulus 2. This is the result of the remainder when 4 is divided by 2. Since there is no remainder when 4 is divided by 2, then

4 % 2 = 0

=> (z && x)

This means (1 && false). This is the result of using the AND operator. Remember that && means AND operator. This will return false (or 0) if one or both operands are false. It will return true (or 1) if both operands are true.

In this case since the right operand is a false, the result will be 0. i.e

(z && x) = (1 && false) = 0

<em>ii. Solve either the multiplication or division next whichever one comes first.</em>

=> 2 * y

This means the product of 2 and y ( = 5). This will give;

2 * y = 2 * 5 = 10

=> 6 / 2

This means the quotient of 6 and 2. This will give;

6 / 2 = 3

<em>iii. Now solve the addition by first substituting the values calculated earlier back into F.</em>

F = (4%2)+2*Y +6/2 +(z&&x)

F = 0 + 10 + 3 + 0

F = 13

Therefore, the value of F is 13

5 0
2 years ago
It is ok to sell services on Xbox in exchange for real-world money
Sati [7]
Is this a true or false question? If it is let me know and I can help! (:
6 0
3 years ago
Read 2 more answers
Other questions:
  • Building relationships during your career exploration is called?
    5·1 answer
  • Host A is sending Host B a large le over a TCP connection. Assume Host B has no data to send Host A. Host B will not send acknow
    14·1 answer
  • Write a function in Java that implements the following logic: Given a string and an int n, return a string made of n repetitions
    15·1 answer
  • why is there a need of properly interpreting teacher's/manufacturer's specifications before operating any food processing equipm
    9·1 answer
  • FREEE POINTS
    8·2 answers
  • Help!!
    15·1 answer
  • Chose the term that matches each definition.
    15·1 answer
  • Answer for 5,6,7 any one know plz
    8·1 answer
  • Meera has created a small program in Python. She wants to store elements of the same data type in an organized
    7·1 answer
  • A computer is the __________ of an attack when it is used to conduct an attack against another computer.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!