#include <iostream.h>
#include <cstdlib>
int main ()
{
int bil;
double L,a,t;
double p,l;
double r;
cout<<"PROGRAM HITUNG RUMUS MATEMATIKA \n";
cout<<"******************************* \n";
atas :cout<<"1 :Luas segitiga \n";
cout<<"2 :Luas persegi panjang \n";
cout<<"3 :Luas lingkaran \n";
cout<<"4 :Exit \n";
cout<<"******************************* \n";
cout<<"input case :";
cin>>bil;
switch (bil)
{
case 1 :cout<<"input alas :";
cin>>a;
cout<<"input tinggi :";
cin>>t;
L=a*t/2;
cout<<"luas segitiga :"<<L<<endl;
goto atas;
break;
case 2 :cout<<"input panjang :";
cin>>p;
cout<<"input lebar :";
cin>>l;
L=p*l;
cout<<"luas persegi panjang :"<<L<<endl;
goto atas;
break;
case 3 :cout<<"input jari-jari :";
cin>>r;
L=2*3.14*r;
cout<<"luas lingkaran :"<<L<<endl;
goto atas;
break;
case 4 :cout<<"exit \n";
break;
}
return 0;
}
Rabu, 13 April 2011
contoh program c++ menghitung rumus matematika
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar