using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class segitiga{
float alas,tinggi;
public:
void luas(int,int);
float hasil(void){
float hasill=(alas*tinggi/2);
return(hasill);
}
};
void segitiga::luas(int a,int b){
alas=a;
tinggi=b;
}
int main(int argc, char** argv) {
system ("color b");
segitiga eek;
float x,y;
cout<<"|========================|\n";
cout<<"|Menghitung Luas Segitiga|\n";
cout<<"|========================|\n";
cout<<"|Thedi Wrys (1500018081)|\n";
cout<<"|========================|\n \n";
cout<<"Masukan Tinggi: ";cin>>x;
cout<<"Masukan Alas: ";cin>>y;
eek.luas(x,y);
cout<<"Luas segitiga: "<<eek.hasil();
return 0;
}
Luas Segitiga thediwrys.blogspot.com |
No comments:
Post a Comment