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]
1 year 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]1 year 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
What category of predefined formulas in Excel contains the Boolean functions?
ololo11 [35]
The predefined formulas in Excel that contain the Boolean functions fall under the Logical Functions category. The Boolean functions consist of "AND", "OR", "XOR", "NOT", "IF", "IFERROR" and "IFNA".  When you need to use an Excel Function, you can type the function into the cell. You also need to add the arguments for the function in between brackets. If the function is complex or you are a beginner user, there is a function inputting tool which will help you choose which function you require. 

5 0
3 years ago
Which control segment communicates with the satellites? OA master stations O B. monitoring stations O C. ground antennas D. cont
nignag [31]

Answer:

C. ground antennas

Explanation:

AKA Satellite Dishes That Communicate Just Like Direct Tv dish It is focused by a bowl-shaped parabolic dish onto a device in the center called a "feed horn", which channels the signal to a "low-noise block down converter" (LNB) which filters out unwanted interference, and sometimes converts it to yet another frequency before amplifying it and sending it to the satellite receiver

5 0
2 years ago
7. Question
Zigmanuir [339]
All server side errors start with 5XX
8 0
3 years ago
What was the first 1.0.1 version of openssl that was not vulnerable to heartbleed?
vovikov84 [41]
I suggest you to read OpenSSL changelogs to make it more clear. As there's not enough space to describe how it works. But heartbleed resistan version was 1.0.2, as I know.
5 0
2 years ago
Read 2 more answers
It's the same drop-down answers for both.
tia_tia [17]

Answer:

First, medium: can see all the subject but maintain the focus in him

Second, close-up: To se the facial expressions and emotions

5 0
2 years ago
Other questions:
  • Why is the answer A?
    6·1 answer
  • The grade of a metric bolt is designated by
    8·1 answer
  • A(n) __________attack is designed to render the target unreachable by legitimate users, not to provide the attacker access to th
    8·1 answer
  • Which of the following types of network can only be accessed by members within a private organization?
    5·1 answer
  • Computer privacy typically occurs when which of the following is violated?
    6·1 answer
  • Identify the equation that translates Y = In(x) five units down.​
    8·1 answer
  • Which of the following statements is/are correct? a. At the network layer, entitlement can map identity and/or attributes to fun
    8·1 answer
  • Two technicians are discussing Newton's first law of motion. Technician A says that a lightweight vehicle requires as
    8·1 answer
  • please help me to do this computer homework I beg you all please help me to get the answers please its important please ​
    12·1 answer
  • Redesign the cover of science textbook using at least two different graphics​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!