اولا يجب ان نعرف قانون مساحة المثلث=0.5×طول القاعدة×الارتفاع
لذلك سنعرف متغير للطول واخر للارتفاع حيث يتم ادخالهم من قبل المستخدم وايضا متغير اخر لنخزن فيه قيمه المساحه للمثلث.
;double A,B
;double trianglearea
;"cout << "please enter the Length of the triangle
; cin>> A
;"cout << "please enter the height of the triangle
; cin>> B
; 0.5*trianglearea =A*B
;cout <<"the area of the triangle is "<< trianglearea