C++

Assume the existence of a Window class with integer data members width and height. Overload the << operator for the Window class-- i.e., write a nonmember ostream-returning function that accepts a reference to an ostream object and a constant reference to a Window object and sends the following to the ostream: 'a (width x height) window' (without the quotes and with width and height replaced by the actual width and height of the window. Thus for example, if the window had width=80 and height=20, << would send 'a (80 x 20) window' to the ostream object.) Don't forget to have the function return the proper value as well. Assume the operator has been declared a friend in the Window class.

Answers

Answer 1

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.


Related Questions

thick is incorrect does anybody know the correct answer? please don’t send any files i can’t open them

Answers

Answer:

i think its new

Explanation:

if this is incorrect i apologize

Which titles fits this Venn diagram best?

A Venn diagram with 2 circles. The left circle is titled Title 1 with entries a group of occupations with similar tasks; examples: law enforcement, agriculture, pharmaceuticals. The right circle is titled Title 2 with entries a specific set of responsibilities and tasks performed; examples: waitress, peach farmer, police dispatcher. The middle has entries involve a person's daily work, done to earn money.

Title 1 is “Jobs” and Title 2 is “Careers.”
Title 1 is “Careers” and Title 2 is “Jobs.”
Title 1 is “Self-Employed” and Title 2 is “Company-Employed.”
Title 1 is “Company-Employed” and Title 2 is “Self-Employed.”

Answers

The answer is You looking for is C

Answer:

B. Title 1 is “Careers” and Title 2 is “Jobs.”

Explanation:

edg 22 unit test in career explorations A

heyyyyyy
byeeeeeeeeeeeeeeeeeeeeeee

Answers

Answer:

byeeeeeeee

Explanation:

Answer:

Heyyyyyyy

Byeeeeeee

Explanation:

how many colors are in microsoft word?

Answers

Answer:

4 Owo

Explanation:

XOXO

Kit

Lillian is creating a presentation about social media and she would like to include transitions to add flair. What does she need to do to make sure her transitions are balanced?

Apply one simple transition to all of her slides.
Use a different transition for each slide.
Add a subtle transition to every other slide.
Give each slide a different duration time.

Answers

apply one simple transition to all of her slides i believe

Answer:

A: Apply one simple transition to all of her slides.

Explanation:

I got it correct on a quiz I did that had this question.

An organization would like to determine which streams will carry certain levels of fertilizer runoff from nearby agricultural
areas.
Which specialized information system does this situation represent?

Superfund Information Systems

Geographic Information Systems

Electronic Medical Record Systems

Emergency Department Information Systems

Answers

Answer:

GIS - Geographic Information System

What is the purpose of this rectangular shape in a flowchart?

Answers

The rectangular shape in a flowchart is used to show a task or a process to be done to proceed the process further.

What is a flowchart?

A flowchart is a diagrammatical representation of a task that is to be conducted and performed in a proper sequence. There are various types of flowcharts shapes, that represent something different for task completion.

The actual purpose of rectangular shape in middle of the flowchart is to instruct the reader or the performer to complete the task or perform the action for the completion of the process.

Learn more about flowchart, here:

https://brainly.com/question/14956301

#SPJ2

PLEASE HELP IM GIVING BRAINLIEST!!

Create properly formatted works cited page for a research paper about the dangers of cell phone use on the road. Follow the MLA citation format, and make sure to correctly italicize each citation. For the purpose of this activity, it is not necessary to observe the MLA rules for indentation. Use the six sources provided to support the research paper.

Answers

Answer:

Cell phone use causes traffic crashes because a driver's cognitive performance significantly decreases when they are using a cell phone. Texting is also dangerous because the driver is taking their eyes away from the road and their hands away from the wheel. Driving demands a high level of concentration and attention.

Explanation:

PLz brainlyest

Dan's team has to develop billing software for a supermarket. During which step will they write the program for the software?

Which step will involve finding errors in the software?

Answers

Answer:

coding phase

testing/debugging phase

Explanation:

During the coding phase they will write the actual code which creates the functionality/program which is added to the software. This phase comes after the dev team designs the algorithm and creates a flow chart of the algorithm. This flow chart is what is used to create the code itself. After the code is complete then the dev team will go into the testing/debugging phase where they will test the program with different test cases. If any bugs/errors are found they will return to the code and implement changes to fix these errors.

3. Wi-fi connections have limited range of :

A.10 metres
B.600 metres
C.20 metres
D.300 metres​

Answers

Answer: D) 300 metres would be my choice because our wifi can only go that far outdoors, inside wifi can only travel up to 150 metres.

Explanation: Hope this helps! Have a wonderful day!

Don’t forget to thanks & Brainliest is always appreciated!

7.2 code practice edhesive

Answers

Answer:

Explanation:

got a 100

The python program method code and its description can be defined as follows:

Python code:

def ilovepython():#defining the method ilovepython

   for i in range(0,3):#defining a loop that prints value 3 times

       print ("I love Python")#print message

ilovepython()#calling the method

Output:

Please find the attached file.

Code Explanation:

Defining the method "ilovepython".Inside the method, a for loop is declared that uses the range method in which it prints the value 3 times. Inside the loop, a print method is used that prints the message value that is "I love Python".Outside the method, method "ilovepython" is called that prints the given message value 3 times.

Find out more about the loop here:

Select all that apply. What two values do comparison operators return ?

Answers

True and equal is the answer

please answer no files !!

Answers

Answer:

im not exactly sure but i think its c

Explanation:

are used in the Excel application to create calculations

Answers

Answer:

I think the answer is formulas

Pretty sure it is ‘Functions’

What must an individual understand to create websites using professional software?

(A) Graphic design
(B) Coding languages
(C) Preset layouts
(D) Photography

Answers

Answer:

(B) Coding languages

Explanation:

Select the correct text in the passage.
Select the appropriate guidelines to create and manage files in the passage given below. (In parentheses)

Guidelines for organizing files and folders
First, (select a central location to organize all your files, folders, and sub-folders).
Then double-click the folder or folders to identify which file you want to move. Now (use Windows Explorer to navigate and paste the file in the
required location).
Effective file management helps reduce the stress of looking for files and saves you a lot of time. All file types have unique file extensions that helpyou (determine which program to use to open a particular file and to access its data.)
If your computer crashes, all files and folders on the desktop are lost and it is often impossible to recover them. You should (maintain your
personal and professional files separately.) The file system on your computer already (keeps track of the date the file was created and modified,)
Therefore, chronological sorting is not necessary.
It is a great idea to (categorize your data into folders.) It is even better to (segregate them further into sub-folders.) If you maintain a list of
sub-folders under every main folder, you will be able to access all your tasks easily. For example, you could put your school subjects under
different sub-folders to organize your data efficiently on your computer.
Any file you create and use should have a proper description. It is important to create accurate names for each file, especially if you have a large
number of files in a folder, and you need to (select a single file to work on.)

Answers

Answer:

The appropriate guidelines to create and manage files in the passage:

O.  First, (select a central location to organize all your files, folders, and sub-folders).

O.  Then double-click the folder or folders to identify which file you want to move.

O.   Now (use Windows Explorer to navigate and paste the file in the

required location).

The correct text in the passage is:

O.   It is a great idea to (categorize your data into folders.) It is even better to (segregate them further into sub-folders.) If you maintain a list of  sub-folders under every main folder, you will be able to access all your tasks easily. For example, you could put your school subjects under  different sub-folders to organize your data efficiently on your computer.

Explanation:

Answer:

Behold.

Explanation:

resources that can be saved through the use of computers​

Answers

Answer:

Yes. That's what the internet is all about. Saving resources through interconnected computers.

Which of the following cloud features is represented by leveraging remote monitoring and system tuning services?

Reliability

Performance

Utilization

Maintenance

Answers

Answer:

Reliability

Explanation:

Salim wants to add a device to a network that will send data from a computer to a printer. Which hardware component should he use?

A.
repeater
B.
modem
C.
switch
D.
bridge

Answers

It’s letter B good luck
I think person above is correct (sorry if I'm wrong I just need points)

Recommend how could you integrate positive aspects of digital literacy into your own
practice of learning.
PLEASE HELP

Answers

Answer:

please give me brainlist and follow

Explanation:

7 Ways to Teach Digital Literacy

Emphasise the importance of critical thinking. ...

Use social media for learning and collaborating. ...

Provide guidance on how to avoid plagiarism. ...

Teach students to manage their online identity. ...

Help students manage digital distractions. ...

Provide authentic contexts for practice. ...

Guide students out of their comfort zone.

For this exercise, you will complete the TicTacToe Board that we started in the 2D Arrays Lesson.

We will add a couple of methods to the TicTacToe class.

To track whose turn it is, we will use a counter turn. This is already declared as a private instance variable.

Create a getTurn method that returns the value of turn.

Other methods to implement:

printBoard()- This method should print the TicTacToe array onto the console. The board should include numbers that can help the user figure out which row and which column they are viewing at any given time. Sample output for this would be:

0 1 2
0 - - -
1 - - -
2 - - -
pickLocation(int row, int col)- This method returns a boolean value that determines if the spot a user picks to put their piece is valid. A valid space is one where the row and column are within the size of the board, and there are no X or O values currently present.
takeTurn(int row, int col)- This method adds an X or O to the array at position row,col depending on whose turn it is. If it’s an even turn, X should be added to the array, if it’s odd, O should be added. It also adds one to the value of turn.
checkWin()- This method returns a boolean that determines if a user has won the game. This method uses three methods to make that check:

checkCol- This checks if a player has three X or O values in a single column, and returns true if that’s the case.
checkRow - This checks if a player has three X or O values in a single row.
checkDiag - This checks if a player has three X or O values diagonally.
checkWin() only returns true if one of these three checks is true.

public class TicTacToeTester
{
public static void main(String[] args)
{
//This is to help you test your methods. Feel free to add code at the end to check
//to see if your checkWin method works!
TicTacToe game = new TicTacToe();
System.out.println("Initial Game Board:");
game.printBoard();

//Prints the first row of turns taken
for(int row = 0; row < 3; row++)
{
if(game.pickLocation(0, row))
{
game.takeTurn(0, row);
}
}
System.out.println("\nAfter three turns:");
game.printBoard();



}
}

public class TicTacToe
{

private int turn;
private String[][] board = new String[3][3];

public TicTacToe()
{
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 3; j++)
{
board[i][j] = "-";
}
}
}

//this method returns the current turn
public int getTurn()
{
return turn;
}

/*This method prints out the board array on to the console
*/
public void printBoard()
{

}

//This method returns true if space row, col is a valid space
public boolean pickLocation(int row, int col)
{
return true;
}

//This method places an X or O at location row,col based on the int turn
public void takeTurn(int row, int col)
{

}

//This method returns a boolean that returns true if a row has three X or O's in a row
public boolean checkRow()
{
return true;
}

//This method returns a boolean that returns true if a col has three X or O's
public boolean checkCol()
{
return true;
}

//This method returns a boolean that returns true if either diagonal has three X or O's
public boolean checkDiag()
{
return true;
}

//This method returns a boolean that checks if someone has won the game
public boolean checkWin()
{
return true;
}

}

Answers

ndjdjdbzkdkekkdjdjdkodododofiifidididiidieiekeieidid

When you use the Insert Sheet Rows command, the Insert dialog box lets you specify where the new column is to be located.


Please select the best answer from the choices provided

T
F

Answers

Answer: False

Explanation:

There are a number of ways to insert blank columns or rows in spreadsheet program e like Microsoft excel. The method referred to above, which is using the insert option in the home tab. In Microsoft Excel 2016, once the insert option is chosen, there is an option to insert cells, insert sheet rows, insert sheet columns and insert sheets. Click on the insert sheet columns, a new column is automatically right before the location of the current selected cell. There is no dialog box which pops up to enable user specify the location of the new column when using this column addition option.

Your _______ can help block inappropriate content online.
1. web browser
2. Password

Answers

Answer:

web browser.

Explanation:

yea let me go post my password to block content (sarcasm)

Describing the technologies used in diffrent generation of computer​

Answers

Answer:

1940 – 1956: First Generation – Vacuum Tubes. These early computers used vacuum tubes as circuitry and magnetic drums for memory. ...

1956 – 1963: Second Generation – Transistors. ...

1964 – 1971: Third Generation – Integrated Circuits. 1972 – 2010: Fourth Generation – Microprocessors.

Which sentences use antonyms to hint at the meaning of the bolded words? Check all that apply.
The dog cowered and hid behind the couch during thunderstorms.
Most of the house was destroyed by the tornado, but the kitchen remained intact.
He was extravagant with money, buying everything in sight whenever he had the means.
Performing onstage caused him discomfort; he felt comfortable staying out of the spotlight.
The opportunity didn't last long; it quickly dwindled, or went away.
Hello

Answers

Answer:

Most of the house was destroyed by the tornado, but the kitchen remained intact.

Performing onstage caused him discomfort; he felt comfortable staying out of the spotlight.

Explanation:

I got it right on Edge, good luck :)

Answer:

b,d

Explanation:

edge 22

Is a system software that manages the hardware resources and provides services 5o the application software

Answers

Answer:

"Operating system" is the right response.

Explanation:

The key program collection on something like a computer device that maintains it interacts mostly with underlying hardware of that system is considered as an Operating system.Even without the need for an OS, every consumer isn't able to access either equipment, monitor as well as portable phone or devices.

oml this question has 500+ thanks...HOW

Answers

Answer:

nice

Explanation:

:)

Answer:

cool congratulations

Write a program that creates a two-dimensional array named height and stores the following data:

16 17 14
17 18 17
15 17 14
The program should also print the array.

Expected Output
[[16, 17, 14], [17, 18, 17], [15, 17, 14]]

Answers

Answer:

Explanation:

The following code is written in Java and it simply creates the 2-Dimensional int array with the data provided and then uses the Arrays class to easily print the entire array's data in each layer.

import java.util.Arrays;

class Brainly {

   public static void main(String[] args) {

       int[][] arr = {{16, 17, 14}, {17, 18, 17}, {15, 17, 14}};

   

     

      System.out.print(Arrays./*Remove this because brainly detects as swearword*/deepToString(arr));

   }

}

Answer:

height = []

height.append([16,17,14])

height.append([17,18,17])

height.append([15,17,14])

print(height)

Explanation:

I got 100%.

1
How were stories told in the earliest days of human civilization?
they were written in books
they were crafted in stained-glass art in religious buildings
they were traded as currency
they were told by elders around fires at night
2
Which skill-based video games mostly involve critical thinking or problem solving?
puzzle games
role-playing games
shooter games
platformer games
3
What is an example of an operation for a game?
jumping over Bowser in a Mario game
motion-capture devices (e.g., Kinect, WiiMote)
matching three-of-a-kind to clear obstacles
achieving a high score in Pac-Man
4
What describes a special kind of game that is designed to mimic an experience or activity so that you can learn about it first-hand?
simulation
adventure
role-playing
puzzle
If u get it right u get brainliest

Answers

1

they were crafted in stained-glass art in religious buildings

2

puzzle games

3

motion-capture devices (e.g., Kinect, WiiMote

4

puzzle

simulation

Which piece of evidence from the article MOST
appeals to the reader's sense of logic?
A
Many of you have seen teachers who read the
slides on the screen word-for-word, which is
dull and repetitive.
B.
In comparison, 38 percent of the impact comes
from what you say and 7 percent from the text
on each slide.
C
Green, for instance, is commonly associated
with the stoplight and the dollar bill, so you can
use the color to signify action or wealth.
D
Kawasaki, for example, thinks that an ideal
PowerPoint presentation should last no longer
than 20 minutes.

Answers

Answer:

A  - Many of you have seen teachers who read the

slides on the screen word-for-word, which is

dull and repetitive.

Other Questions
Helppp meeee pleaseeeeee what does venerable mean i get a 25% discount (means decrease) at macys store. if i find a dress i like for $80, how much will i have to pay for it? Which of the following describes the line spacing feature? Select all that apply. adds space between words adds space between lines of text adds space between paragraphs adds space at the top and bottom of a page adds bullet points or numerical lists What did World War II result in? What can people do if they feel that a law is unfair? Investigate the Equal Rights Amendment on your own. Then, consider the factors that affect change, and explain two key reasons that the Equal Rights Amendment might not have been ratified, based on the ideas in this lesson. Justify your reasons with cited sources. Sara uses 9.3 pints of white paint and blue paint to paint her bedroom walls. 3/5 of this amount is white paint, and the rest is blue paint. How many pints of blue paint did she use to paint her bedroom walls? Can one of you guys help me I will give you the brain thing if you help me this correct way how humans can improve the negative aspects of soil use FULL SENTENCES 50 POINTS PLEASE HELP What is the length of a segment with endpoints (2, 5) and (10, 11) *5 units8 units10 units14 units Decide if the following definite article and noun agreement is CORRECT or INCORRECT.los profesorasCorrectIncorrect The evaporator:A. directs airflow to the condenser.B. absorbs heat from the passenger compartment.C. removes moisture from the refrigerant.D. restricts refrigerant flow. 4(x+2)=4x+8 need help escribir tres oraciones y subraya la frase nominal Which three southern states had the smallest percentage of white people? x=1 and y=32x+3y-2plsss helpp Hope with a question Bacteria are the most common example of exponential growth. Select a number between 2 and 10 to represent the hourly growth rate of a certain bacteria. For example, selecting the number 8 would mean that the amount of bacteria will be 8 times greater after every hour. a. Suppose you start with one single bacterium. Make a table of values showing the number of bacteria that will be present after each hour for the first six hours using the hourly growth rate that you selected. Then determine how many bacteria will be present once 24 hours have passed. b. Explain why this table represents exponential growth. c. Using this example, explain why any nonzero number raised to a power of zero is equal to one. d. Write a rule for this table. e. Suppose you started with 100 bacteria, but they still grew by the same growth factor. How would your rule change? Explain your answer.