Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

baseValue and heightValue are read from input. Declare and assign pointer myTriangle with a new Triangle object. Then, set myTriangle's base and height to baseValue

baseValue and heightValue are read from input. Declare and assign pointer myTriangle with a new Triangle object. Then, set myTriangle's base and height to baseValue and heightValue, respectively.

Ex: if the input is 10.0 5.5, then the output is:

Triangle's base: 10.0 Triangle's height: 5.5

#include #include using namespace std;

class Triangle { public: Triangle(); void Print();

double base; double height; }; Triangle::Triangle() { base = 0.0; height = 0.0; } void Triangle::Print() { cout << "Triangle's base: " << fixed << setprecision(1) << base << endl; cout << "Triangle's height: " << fixed << setprecision(1) << height << endl; }

int main() { double baseValue; double heightValue; /* Additional variable declarations go here */ cin >> baseValue; cin >> heightValue; /* Your code goes here */ myTriangle->Print(); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions