25. Luas Layang- layang
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class layang_layang
{
private :
int t1, t2;
public:
int luas()
{
return(((t1*t2)*1/2));
}
void masuk(int T1, int T2)
{
t1=T1;t2=T2;
}
};
int main(int argc, char** argv)
{
system ("color b");
layang_layang umbul,umbull;
int a,b;
cout<<"|========================|\n";
cout<<"|Menghitung Layang Layang|\n";
cout<<"|========================|\n";
cout<<"|eka indah sari |\n";
cout<<"|========================|\n \n";
cout<<"masukkan nilai a:";cin>>a;
cout<<"masukkan nilai b:";cin>>b;
umbul.masuk(a,b);
umbull.masuk(10,5);
cout<<"Luas Pertama: "<<umbul.luas()<<endl;;
cout<<"Luas Kedua : "<<umbull.luas();
return 0;
}
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class layang_layang
{
private :
int t1, t2;
public:
int luas()
{
return(((t1*t2)*1/2));
}
void masuk(int T1, int T2)
{
t1=T1;t2=T2;
}
};
int main(int argc, char** argv)
{
system ("color b");
layang_layang umbul,umbull;
int a,b;
cout<<"|========================|\n";
cout<<"|Menghitung Layang Layang|\n";
cout<<"|========================|\n";
cout<<"|eka indah sari |\n";
cout<<"|========================|\n \n";
cout<<"masukkan nilai a:";cin>>a;
cout<<"masukkan nilai b:";cin>>b;
umbul.masuk(a,b);
umbull.masuk(10,5);
cout<<"Luas Pertama: "<<umbul.luas()<<endl;;
cout<<"Luas Kedua : "<<umbull.luas();
return 0;
}
Komentar
Posting Komentar