Thursday, October 26, 2017

Area of the Triangle Solver in C++

A very simple program that I wrote using C++ to compute the area of the triangle based on the given base and height value of our user. The code is very easy to understand and use. I hope you will like it.

I am currently accepting programming work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.





Sample Program Output


Program Listing

area.cpp


// Area of the Triangle Solver in C++
// Author   : Mr. Jake R. Pomperada, MAED-IT
// Date     : October 26, 2017
// Language : C++
// Place    : Bacolod City, Negros Occidental Philippines
// Tools    : CodeBlocks


#include <iostream>
#include <iomanip>

using namespace std;

int main()
{

    int height=0,base=0;
    float area;

    cout << "===================================";
    cout << "\n";
    cout << "Area of the Triangle Solver in C++";
    cout << "\n";
    cout << "===================================";
    cout << "\n\n";
    cout << "Give the height : ";
    cin >> height;
    cout << "Give the base   : ";
    cin >> base;
    area = (height * base) /2;
    cout << "\n\n";
    cout << fixed << showpoint;
    cout << setprecision(2);
    cout << " The area of the triangle is  " << area << ".";
    cout << "\n\n";
    cout << "===== End of the Program =====";
    cout << "\n\n";
}



No comments:

Post a Comment