Wednesday, September 22, 2010

fungsi keliling dan luas dengan c++ ( c++ function)

# include
# include
double hitung_keliling_kotak(double panjang, double lebar)
{
 double keliling;
 keliling = 2 * (panjang + lebar);
 return keliling;
}

double hitung_luas_kotak(double panjang, double lebar)
{
 double luas;
 luas = panjang * lebar;
 return luas;
}

int main ()
{
 char ul;
 do
 {
 double keliling, luas, panjang, lebar;
 clrscr ();
 cout<<" MeNghituNg KeLiLiNg & LuaS PeRsegi PaNjaNg"<
 cout<<"============================================="<
 cout<<"MaSuKkaN PaNjaNg : ";
 cin>>panjang;
 cout<<"MaSuKkaN LebaR : ";
 cin>>lebar;
 keliling = hitung_keliling_kotak(panjang, lebar);
 luas = hitung_luas_kotak(panjang, lebar);
 cout<<"===>>> KeLiLiNgnYa = "<<<"\n";
 cout<<"==>>> LuaSnYa = "<<<"\n";
 cout<<" "<
 cout<<"Apakah aNda iNgiN MeNguLaNg..[Y/T]??? ";
 cin>>ul;
 }
 while (ul!='t');
 return 0;
}
Web Hosting

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Laundry Detergent Coupons