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
Which type of portfolio might a young investor who is not afraid of risk choose?
Keith_Richards [23]
i think it would be the investment with high risk and high return such as Stocks.When investing in stock, investor analyze whether a specific company will be doing well in the time of investment (which will increase the market price of the stock) and take a profit from it.
7 0
3 years ago
Which type of cables are used for high-capacity trunk lines that provide main routes for telephone, cable, and internet communic
Naily [24]

Answer:

Fiber-optic cable

Explanation:

Before the cable industry transitioned to fiber-optic cables, for many years, the standard cables used for telephone, cable, and internet communications were coaxial cables. The transition was made possible because the architecture of the fiber-optic cable came with a higher capacity, more extensive bandwidth link. Unlike the coaxial or the twisted pair cable, the fiber-optic is made from glass strands that transmit light signals much quicker and to greater distances. This makes fiber-optic cables the fastest high capacity data transfer link than any other cables to ever exist.

3 0
2 years ago
Show how to define a view tot_credits (year, num_credits), giving the total number of credits taken by students in each year
andreev551 [17]

Hi! I'm a Digital Marketer Intern at hotels.ng and I have a moderate knowledge on programming.

First, your  question is not very explanatory. The term "view" is often used in back-end web development. A view is simply a Python function that takes a Web request and returns a Web response.

But I'm not sure this is what you want, so I'll just go ahead and write a python function involving class to return the total number of credits taken by a student.

I'll answer this question using Python.

class student(object):  

    credits = None

    year = None

    def num_credits(self):


       #get credit value

       self.credits = input("Enter the total number of credits: "  )


       pass

    def getYear(self):

        self.year = input("Enter current year: ")

        pass

    def tot_credits(self):

          TotalCredits = tempTotalCredits + self.num_credits

           print "Your  total credits are :"+" "+str(TotalCredits)




3 0
3 years ago
Do applications need to exchange udp control messages before exchanging data
Molodets [167]

The answer is NO.

Thats what makes UDP connectionless. Aclient that is going to send a UDP message to the server just sends it.The server does not know it is coming untill it arrives .When a server recieves a UDP message it gets the source address/port and the data.

7 0
3 years ago
What is the output of the following query? SELECT INSERT ('Knowledgeable', 5, 6, 'SUPER');
Scrat [10]

Answer:

The above query gives an error.

Explanation:

  • The query gives an error because is not the correct syntax of the select or inserts query.
  • The syntax of the select query is as follows: "select Attributes_1_name, Attributes_2_name,...., Attributes_n_name from table_name;".
  • The syntax of the insert query is : "insert into table_name (column_1_name, column_2_name,...,column_n_name) values (column_1_value, column_2_value,...,column_n_value);".
  • The syntax of the insert and select query is : "insert into table_name (select Attributes_1_name, Attributes_2_name,...., Attributes_n_name from table_name);".
  • But the above query does not satisfy any property which is defined above. Hence it gives a compile-time error.
6 0
3 years ago
Other questions:
  • What is a spec sheet?
    9·1 answer
  • ____ software is rights-protection software used to control the use of a work.
    9·1 answer
  • Florida Highway Safety and Motor Vehicles reported blank of traffic fatalities were alcohol-related in Florida in 2009.​
    8·1 answer
  • Please help. 15 points!!!!
    8·2 answers
  • Suppose that a program asks a user to enter multiple integers, either positive or negative, to do some calculation. The data ent
    13·1 answer
  • Explain the three schemes via which the binding of instructions and data to memory addresses can be done. In each scheme, how th
    13·1 answer
  • I think you have been doing a great job but you haven’t been signing many people up for our new service feature I want you to se
    8·1 answer
  • Use the drop-down menus to explain how to locate the Consolidate dialog box.
    6·1 answer
  • Which storage is faster than secondary storage​
    14·2 answers
  • In C++ we can print message for the user in Arabic?<br><br> A. True<br> B. False
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!