/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
class lingkaran {
public :
lingkaran ();
void input();
void proses();
private :
int r;
float keliling;
};
lingkaran::lingkaran(){
cout<<"=================================\n";
cout<<"Menghitung Keliling Lingkaran\n";
cout<<"=================================\n";
}
void lingkaran::input (){
cout<<"Masukkan Jari-Jari : ";
cin>>r;
}
void lingkaran::proses(){
keliling=2*(22/(float)7)*r;
cout<<"Keliling : "<<keliling;
}
int main(int argc, char** argv) {
lingkaran Lkrn;
Lkrn.input();
Lkrn.proses();
return 0;
}
Comments
Post a Comment