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
DIA [1.3K]
3 years ago
15

Write a C++ program that prompt the user to enter three points (x1, y1), (x2, y2), (x3,y3) of a triangle and displays its area.

Computers and Technology
1 answer:
maxonik [38]3 years ago
5 0

Answer:

Here is the 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,x3,y3;

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;

cout<<"Please Enter the coordinate of third point (x3,y3): ";

// reading coordinate of third point

cin>>x3>>y3;

//calculating area of the triangle

float area=abs((x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2);

cout<<"area of the triangle:"<<area<<endl;

return 0;

}

Explanation:

Declare four variables x1,x2,x3,y1,y2,y3 to store the coordinate of all three

points of circle.Read the coordinate of all the point from user.Calculate area of triangle with the help of mentioned formula area=abs((x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2). Then print the area of the triangle.

Output:

Please Enter the coordinate of first point (x1,y1): 11 17                                                                                                      

Please Enter the coordinate of second point (x2,y2): 23 30                                                                                                    

Please Enter the coordinate of third point (x3,y3): 43 18                                                                                                      

area of the triangle:202  

You might be interested in
How does a typewriter involve math and science?
patriot [66]
You have a specific number of words typed a minute and you need to know the science involved in making it
8 0
3 years ago
Read 2 more answers
What happens if i unplug my alarm system?
Dafna11 [192]
It loses power and most likely stops working
6 0
3 years ago
Can you hook up an ethernet cable to a phone jack
laila [671]
The connector for ethernet cables is called RJ45. for phone jack is RJ11. Although they look the same, the RJ11 has only 4 leads, as opposed to 9 leads in RJ45. Also, RJ11 is not as wide as RJ45, so the connector does not fit.

Even if it would, the signals would be totally incompatible, so no success can be expected.
8 0
3 years ago
Round 74,361 to the nearest 10​
grandymaker [24]

Answer:

74,400 i think

Explanation:

8 0
3 years ago
In 3–5 sentences, describe how good e-mail work habits increase workplace efficiency and productivity.
Ket [755]
Faster communication, information spread faster, group messages
6 0
3 years ago
Other questions:
  • Approximately what percent of U.S. businesses have some form of remote work program? (from Chapter 1)
    14·1 answer
  • You have a folder on your Windows desktop system that you would like to share with members of your development team. Users need
    13·1 answer
  • How do you fix this windows 7 screen​
    8·1 answer
  • What is a common method for testing a spot weld?
    13·1 answer
  • BI systems have eliminated a common organizational problem, which is simultaneously having too much data but somehow not enough.
    14·1 answer
  • The family size bottle of sunscreen holds 121212 fluid ounces (\text{fl oz})(fl oz)(, start text, f, l, space, o, z, end text, )
    12·1 answer
  • Once a software program has been through one test cycle performed by the programmers and is running proper
    10·1 answer
  • Question 2 (2 points)
    6·1 answer
  • Using range(1,101), make two list, one containing all even numbers and other containing all odd numbers. How can I do this on Py
    15·1 answer
  • Explain impact of modern technology on human life​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!