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
horsena [70]
3 years ago
14

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

Computers and Technology
1 answer:
My name is Ann [436]3 years ago
5 0

Answer:

#include<iostream>

using namespace std;

int main(){

   int x1,x2,x3;

   int y1,y2,y3;

   cout<<"Enter the value of first point(x1,y1): ";

   cin>>x1>>y1;

   cout<<"\nEnter the value of second point(x2,y2): ";

   cin>>x2>>y2;

   cout<<"\nEnter the value of third point(x3,y3): ";

   cin>>x3>>y3;

   

}

Explanation:

first include the library iostream for use the input/output commands

then, write the main function. within the main function declare the variable which store the value of points.

after that, use the 'cout' for output. It has the function which print the value or message on the screen.

and 'cin' is used to store the value in the variable.

So, in the above code cout ask for enter the value of point and after enter value by user, cin store in the variables.

Note: you have to enter two value with space or by enter.

You might be interested in
Public static Object[] question4(Student student1, Student student2)
Archy [21]

Answer:

Complete code is given below:

Explanation:

public static Object[] question4(Student student1, Student student2){

  /* For this exercise you will be using for loops to calculate various values.

  You will be making use of the following object references which are passed as arguments to this method:

  A Student object reference student1

  A Student object reference student2

  You will need to use various accessor methods of the Student class to complete this assignment.

  Additional variables that you will use have already been declared.

  1) Set the value of student1HighestGrade to the highest grade for student1

  2) Set the value of student2HighestGrade to the highest grade for student2

  3) Set the value of student1AverageGrade to the average grade for student1

  4) Set the value of student2AverageGrade to the average grade for student2

  5) Assign the bestHighGradeStudent object reference whichever student has the best high grade

  6) Assign the bestAverageGradeStudent object reference whichever student has the best average grade

  This program contains a main method that can be used to manually test your code by right-clicking Question4.java

  and selecting "Run File"    

  */

 

  int student1HighestGrade, student2HighestGrade;

  double student1AverageGrade, student2AverageGrade;

  Student bestAverageGradeStudent, bestHighGradeStudent;

 

  // Your code goes Here:

 

 

 

  //FINDING HIGHEST GRADE OF STUDENT 1

  student1HighestGrade = -1;   //initially set to minimum

  //iterating through all 8 grades

  for(int i = 0; i < 8; i++){

      //current highest grade is less than ith grade

      if(student1.getExamScore(i) > student1HighestGrade){

          //making ith grade as the highest grade

          student1HighestGrade = student1.getExamScore(i);

      }

  }

 

  //FINDING HIGHEST GRADE OF STUDENT 1

  student2HighestGrade = -1;   //initially set to minimum

  //iterating through all 8 grades

  for(int i = 0; i < 8; i++){

      //current highest grade is less than ith grade

      if(student2.getExamScore(i) > student2HighestGrade){

          //making ith grade as the highest grade

          student2HighestGrade = student2.getExamScore(i);

      }

  }

 

  //FINDING THE GRADE SUM OF STUDENT 1

  student1AverageGrade = 0;   //setting grade sum as 0 initially

  //iterating through all 8 grades

  for(int i = 0; i < 8; i++){

      //adding ith grade to tha total grade sum

      student1AverageGrade += student1.getExamScore(i);

  }

  //FINDING THE AVERAGE GRADE OF STUDENT 1

  student1AverageGrade /= 8;

 

 

  //FINDING THE GRADE SUM OF STUDENT 2

  student2AverageGrade = 0;   //setting grade sum as 0 initially

  //iterating through all 8 grades

  for(int i = 0; i < 8; i++){

      //adding ith grade to tha total grade sum

      student2AverageGrade += student2.getExamScore(i);

  }

  //FINDING THE AVERAGE GRADE OF STUDENT 2

  student2AverageGrade /= 8;

 

 

  //FINDING THE BEST HIGHEST GRADE STUDENT

  if(student1HighestGrade > student2HighestGrade){

      //student1's highest grade is greater than student2's highest grade

      //Best highest grade student is student1

      bestHighGradeStudent = student1;

  }

  else{

      //Best highest grade student is student2

      bestHighGradeStudent = student2;

  }

 

 

  //FINDING THE BEST AVERAGE GRADE STUDENT

  if(student1AverageGrade > student2AverageGrade){

      //student1's average grade is greater than student2's highest grade

      //Best average grade student is student1

      bestAverageGradeStudent = student1;

  }

  else{

      //Best average grade student is student2

      bestAverageGradeStudent = student2;

  }

 

 

 

  // Necessary for Unit Test

  return new Object[] {student1HighestGrade, student2HighestGrade, student1AverageGrade, student2AverageGrade, bestHighGradeStudent, bestAverageGradeStudent};

  }

5 0
3 years ago
Active space is important in which type of photograph?
Artemon [7]
Active space is important in d Motion <span>photography. Active space is required while you need to take picture while you or the object is moving.</span>
5 0
3 years ago
Read 2 more answers
How has social media changed professional networking?
fenix001 [56]

Answer:

It enables and allows to stay people in touch with other globally.

Explanation:

7 0
3 years ago
In a(n) ____________________ device, the movement of electrons performs essentially the same functions as gears and wheels in me
lana66690 [7]

Answer:

Electronic computing.

Explanation:

8 0
2 years ago
Excerpt from "How Prepared Are Students for College Level Reading? Applying a Lexile-Based Approach."
Verizon [17]

Answer: Students graduating from high school are not prepared for college-level work.

Explanation:

From the excerpt, it was written that there is a high rates of enrollment in remedial college courses which shows that there are many students are graduating from high school who are unprepared for college-level work.

Therefore, based on this, the best summary of the paragraph is that the students graduating from high school are not prepared for college-level work.

Therefore, the correct option is C.

7 0
3 years ago
Other questions:
  • At an open or uncontrolled intersection, yield if ____.
    11·2 answers
  • Describe the four techniques mentioned in the article that help you, the speaker, keep your audience engaged
    9·1 answer
  • What is Napoleon's friend's name? From the Napoleon Dynamite movie.
    14·1 answer
  • Access Help defaults to searching for information on the _________.<br><br> Not multiple choice
    10·1 answer
  • Which command should you select to track changes in a document?
    9·2 answers
  • During a network evaluation an administrator discovers excessive cable between a transmitter and its antenna. To clean up the lo
    9·1 answer
  • b) Derive the logic expressions for the incrementor and 7-sgement decoder. Since software can perform gate-level optimization, y
    7·1 answer
  • Hello! I hope you have a great day! Good things will come your way.
    12·1 answer
  • Which information can you apply to every page of your document with the page layout options?
    9·1 answer
  • Please answer this question​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!