I'm pretty sure the answer is b
Style would be the great and best answer but you could add office decor
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.
Answer:
what is the question and answers?
Answer:
Here is code in C++.
//include headers
#include <bits/stdc++.h>
using namespace std;
//main function
int main() {
//variables to store coordinates
float x1,x2,y1,y2;
cout<<"Please Enter the coordinate of first point (x1,y1): ";
// reading coordinate of first point
cin>>x1>>y1;
cout<<"Please Enter the coordinate of second point (x2,y2): ";
// reading coordinate of second point
cin>>x2>>y2;
//calculating Slope of the line that connects these points
float m=(x2-x1)/(y2-y1);
cout<<"Slope of the line that connects these two points is : "<<m<<endl;
}
Explanation:
Declare four variables x1,x2,y1,y2 to store the coordinate of both points.
Read the coordinate of both the point from user. Calculate the slop of the
line which connects these two points with the formula m=(x2-x1)/(y2-y1).
Output:
Please Enter the coordinate of first point (x1,y1): 1 3
Please Enter the coordinate of second point (x2,y2): 5 12
Slope of the line that connects these two points is : 0.444444