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
kupik [55]
3 years ago
10

Write a program that prompt the user to enter the coordinate of two points (x1, y1) and (x2,y2), and displays the slope of the l

ine that connects the two points.
Computers and Technology
1 answer:
zzz [600]3 years ago
3 0

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  

You might be interested in
Which heat transfer can be described as currents of warm air rising and cool air falling
erik [133]
Convection would be the answer to thisssss

3 0
3 years ago
What are the best 3 xbox 360 games ?​
Andru [333]
Halo
GTA
Call of duty
5 0
3 years ago
Read 2 more answers
Which of the following types of software applications would open a file
Mumz [18]
It’s C. An MP3 file is an audio/video file, so only a media player would be able to play this
8 0
3 years ago
Is a bottle opener considered an engineered item?
KIM [24]
Yes actually it is it’s a machine to use for opening bottles such as cans n other
3 0
3 years ago
Which of the following statements best represents the impact vaudeville had on the film industry? Early silent films were more r
maria [59]

Answer:

Answer is B: Early silent film producers used many of the same acting techniques popularized in vaudeville performances, even using popular vaudeville stars as actors in their productions.

Explanation:

7 0
3 years ago
Other questions:
  • A(n) _____ is a type of man-in-the-middle attack where an attacker captures the data that is being transmitted, records it, and
    15·2 answers
  • How can supply and demand for different careers affect job stability and income?
    6·1 answer
  • Learning about public speaking can help improve your ________________.
    15·1 answer
  • There are local administrators for each of the departments, excluding the IT. These local administrators will use the local admi
    7·1 answer
  • Explain the importance of mobile computing in communication​
    7·2 answers
  • What is a set of best practices that helps an organization to maximize the benefits of an information system, while at the same
    5·1 answer
  • Which step in the software development life cycle involves making improvements based on user feedback?
    15·1 answer
  • Who elso does their online school in their bed cause i do
    7·2 answers
  • Leah wants to add an image to her updated presentation, so she wants to access the Help interface. What should Leah do to access
    11·2 answers
  • Instructions
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!