Question: can you show me how to solve this c++ program it doesn't work // Copyright (c) 2020 Ahmad All rights reserved. // // Created by:
can you show me how to solve this c++ program it doesn't work
// Copyright (c) 2020 Ahmad All rights reserved.
//
// Created by: Ahmad
// Created on: DEC 2020
// This program calculates the area of tringle
#include
void area_tringle(float Base1, float Base2, float height ) {
float area;
area = 0.5 * length * height;
// output
std::cout << "The area of the tringle is " << (area)
<< " cm " << std::endl;
}
int main() {
// this function just calls other functions
int Base1;
int Base2;
int Height_of_Trapezoid;
int area;
std::string Base1;
std::string Base1;
std::string Height_of_Trapezoid;
// input
std::cout << "Enter Base1: ";
std::cin >> Base1_string;
std::cout << "Enter Base1: ";
std::cin >> Base2_string;
std::cout << "Enter height: ";
std::cin >> height_string;
try {
Base1 = stof(Base1_string);
Base2 = stof(Base2_string);
height = stof(height_string);
// call functions
area_tringle(Base1, Base2, height);
}
catch (std::invalid_argument) {
std::cout << "That was not a valid integer" << std::endl;
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
