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
The mouse and keyboard are also sometimes called
likoan [24]
Hi!

The mouse and the keyboard are <em>input devices. </em>By using them, we can input data which will give us a (hopefully) desired output!

For example...

Just by using my keyboard to type, I'm inputting data in the form of ASCII characters and symbols.

By using my mouse to click on an area so I can move this sentence on a new line, I had to input a request to do such!

Hopefully, this helps! =)
7 0
4 years ago
Chapter
vichka [17]

Answer:

Seatbelt

Explanation:

The seatbelt allows everyone in the car to remain safe and steady going at certain high miles per hour. None of the other options were made for safety only. Please name brainliest!!!

4 0
3 years ago
g Create a program that prompts a user to enter a login name and password. The correct login name is Admin, and the correct pass
frutty [35]

Answer:

Answered below.

Explanation:

//Program in Python

login_name = "Admin"

password = "PASS"

display = " "

user_login_name = input ("Enter username: ")

user_password = input("Enter your Password: ")

if user_login_name == login_name and user_password == password:

display = "Correct Login"

elif user_login_name != login_name:

display = "wrong username"

elif user_password != password:

display = "wrong password"

print(display)

7 0
3 years ago
What is the data rate on a channel if the transmission duration of a frame of 1250 kb takes 200 ms ?
posledela

Answer:

6250 Kbps

Explanation:

See it in the pic.

8 0
3 years ago
What is a software that allows the user to modify and redistribute?
lara31 [8.8K]
A software that does and allows this is free software
8 0
4 years ago
Other questions:
  • Create an enumeration named Month that holds values for the months of the year. With JANUARY equal to 1, FEBRUARY equal to 2, an
    13·1 answer
  • __________ software helps the computer carry out its basic operating tasks.
    8·1 answer
  • What does using indirect quotations allow a writer to do?
    7·2 answers
  • E-mail is an temporary message medium.<br> a. True<br> b. False
    5·2 answers
  • Please help with the question no. 5 and 7 please help ​
    6·1 answer
  • HELP!!!<br> THIS HAPPENS EVERY TIME
    6·2 answers
  • Which of the following statements is FALSE?
    10·2 answers
  • 1. Write a query in SQL to list the following information of the artists in movie industry. Limit this information to only 5 art
    12·1 answer
  • How would you write out the Python code to PRINT the answer to 5 times 2?
    9·1 answer
  • Discuss the information justify with two examples<br>​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!