Sunday, June 12, 2011

C++ : Algorithms and Programming Calculating Triangle Area

Download

I. ANALYSIS
Input: t (high) area = l * a / 2

II. ALGORITHM


{Reading the real data in the form of long triangular base (a) and high triangle (t) and calculate the extent of the length of the base and a certain high. Area of ​​triangle is calculated by the formula L = 1 / 2 at. The value L in print as the output to the output device.}
DECLARATION a : real {long triangular base, in units of cm} t : real {height triangle, in units of cm} L : real {area of ​​the triangle} DESCRIPTION read (a) read (t) L <- (a * t) / 2 write (L)
III. Source code in C + +
# Include # Include
class circle { friend ostream& operator <<(ostream&, circle&); friend istream& operator>> (istream&, circle&); public: hitung_keliling void () {circumference = 2 * pi * r;} hitung_luas void () {area = pi * r * r;} private: int r; float perimeter, area; };
istream & operator>> (istream& in, circle& A) { cout <<"Finger - finger circle:"; in>> A.r; return is; }
ostream & operator <<(ostream& out, circles& A) { A.hitung_keliling (); A.hitung_luas (); out <<"Circumference =" <download

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More