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
iragen [17]
2 years ago
11

Given class triangle (in files triangle.h and triangle.cpp), complete main() to read and set the base and height of triangle1 an

d of triangle2, determine which triangle's area is larger, and output that triangle's info, making use of triangle's relevant member functions.
ex: if the input is:
3.0 4.0
4.0 5.0
where 3.0 is triangle1's base, 4.0 is triangle1's height, 4.0 is triangle2's base, and 5.0 is triangle2's height, the output is:
triangle with larger area:
base: 4.00
height: 5.00
area: 10.00
given (in main.cpp):
#include
#include "triangle.h"
using namespace std;
int main(int argc, const char* argv[]) {
triangle triangle1;
triangle triangle2;
// todo: read and set base and height for triangle1 (use setbase() and setheight())
// todo: read and set base and height for triangle2 (use setbase() and setheight())
// todo: determine larger triangle (use getarea())
cout << "triangle with larger area:" << endl;
// todo: output larger triangle's info (use printinfo())
return 0;
}
Computers and Technology
1 answer:
kow [346]2 years ago
3 0

The C++ program that would complete the main () and set the base and height of triangle1 and of triangle2 is:

main.cpp

#include <iostream>

#include "Triangle.h"

using namespace std;

int main()

{

   Triangle Tri1;  

Triangle Tri2;

   double base1, height1, base2, height2;

   cout << "Enter a base for your Triangle1: ";

   cin >> base1;

   cout << "Enter a height for your Triangle1: ";

   cin >> height1;

   cout << endl;

   cout << "Enter a base for your Triangle2: ";

   cin >> base2;

   cout << "Enter a height for your Triangle2: ";

   cin >> height2;

   cout << endl;

   

   cout << "################################" << endl;

   

   cout << "Triangle with larger area:" << endl;

   if ((0.5)*base1*height1 > (0.5)*base2*height2){

      Tri1.setValues(base1, height1);

      Tri1.getValues();

      cout << "Area: " << Tri1.getArea() << endl << endl;

}

else{

 Tri2.setValues(base2, height2);

 Tri2.getValues();

    cout << "Area: " << Tri2.getArea() << endl;

}

   

   return 0;

}

Read more about C++ programs here:

brainly.com/question/20339175

#SPJ1

You might be interested in
When santo is formatting the text in his wordart text box, he discovers that by default the text box is formatted with _______ t
Rina8888 [55]
<span>When Santo is formatting the text in his Wordart text box, he discovers that by default the text box is formatted with In Line With Text text wrapping. In order to change the text wrapping you should click the File Tab, then Word Options and then Advanced.

</span>
4 0
4 years ago
In Adobe illustrator cc 2017 which of the following export file ​
eduard

Explanation:

In Adobe illustrator cc (2017) , of the following export file formats cannot preserve transparency

8 0
3 years ago
Match the following Microsoft Windows 7 ​
Dominik [7]

Answer:

Explanation:  will be still function but Microsoft will no longer provide the following: Technical support for any issues

6 0
3 years ago
Why do we need to update database regularly
sergiy2304 [10]
To protect from attackers gaining access by sitting on a certain configuration too long. 
7 0
3 years ago
What is known as networking in the IT field?
Sidana [21]

Answer:

r u Kate tell me plz I love u baby tell me please

4 0
3 years ago
Other questions:
  • Assign to avg_owls the average owls per zoo. Print avg_owls as an integer. Sample output for inputs: 1 2 4 3
    7·1 answer
  • When looking at a poster from the Art Deco movement, what one design characteristic would you most expect to see?
    6·1 answer
  • Match the following tasks with their appropriate timing.
    8·1 answer
  • I’m which part of a profession email should you try to be brief, but highly descriptive
    7·1 answer
  • Whats the difference between copying a file to my desktop and creating a shortcut?
    8·1 answer
  • Operational feasibility, which refers to user acceptance and support, as well as management acceptance and support, is also know
    9·1 answer
  • You will be given a value of n and k, one line each. You will write a program that determines the minimum number of probe attemp
    9·1 answer
  • Options to open, save, and print a document are found on which of the following tabs?
    9·2 answers
  • I will give Brainliest to the best answer, I need urgent HELP
    7·1 answer
  • 1. How do you know that A Drop of Water is an expository<br> text? GENRE
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!