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
Would it be possible to make VR technology in a way that our brain sees imagined experiences using simple impulses (like words)
Ludmilka [50]

Answer:

theoretically yes. we would need to cross and langue gap because our brain signals wouldn't understand words

Explanation:

educated quess

7 0
2 years ago
In order to send a photo in a text message from your cell phone to your cousin's cell phone who lives in New Zealand, is it nece
Nata [24]

Answer: No, because all you need is WiFi for both devices and a messaging app to do it for free like iMessage.

Explanation: Please correct me if I am wrong! :)

8 0
2 years ago
. Question 1. Given the following grammar S → aAb | bBA A → ab | aAB B → aB | b and for each of the following right sentential f
zmey [24]

Answer:

Explanation:

(a) aaAbb (b) bBab (c) aaAbB b

The parse tree and phases are shown in the attached diagram below

5 0
3 years ago
Read 2 more answers
Components of an operating system include process,memory,and file management. what is another component of and operating system
kirza4 [7]

Answer:

Wrong it's actually C.

Explanation:

APEX

4 0
2 years ago
Read 2 more answers
The main workspace of a Windows computer is called the______
andrew11 [14]

Answer:

Desktop

Explanation:

8 0
3 years ago
Other questions:
  • Determine the number of bytes necessary to store an uncompressed binary image of size 4000 × 3000 pixels.
    9·1 answer
  • I need some cool things to do with windows command prompt.
    13·1 answer
  • Is a network traffic management device used to connect different network segments together?
    9·1 answer
  • People in STEM careers are considered thinkers who reach conclusions through sound judgment and reasoning.
    11·1 answer
  • The __________ assumption necessary for a linear programming model to be appropriate means that the contribution to the objectiv
    6·1 answer
  • The command-line interface tells a user that it's ready to receive commands by displaying a specific set of characters called a(
    12·1 answer
  • What are four differences between tablets and smartphones?
    6·2 answers
  • 3. The following is a dump of a UDP header in hexadecimal format. 0045DF000058FE20 a. What is the source port number? b. What is
    15·1 answer
  • On the new iOS version, can you save photos from ‘review confirmed photos’? If so, how? Thanks!
    10·1 answer
  • Starting in 2024 under a new law, all new smartphones sold in the eu must have….
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!