#include <iostream.h>
#include <stdio.h>
#include <conio.h>
int volume_bola()
{
clrscr();
int j,vb;
cout<<"menghitung volume bola"<<endl<<endl;
cout<<"masukkan jari-jari = ";cin>>j;
cout<<endl;
vb=3.14*(j*j*j)/3*4;
cout<<"volume bola = "<<vb ;
getch ();
return 0;
}
int volume_kubus()
{
clrscr();
int s,vk;
cout<<"menghitung volume kubus"<<endl<<endl;
cout<<"masukkan sisi kubus = ";cin>>s;
cout<<endl;
vk=s*s*s;
cout<<"volume kubus = "<<vk;
getch();
return 0;
}
int volume_limas()
{
clrscr();
int vl,la,t;
cout<<"menghitung volume limas"<<endl<<endl;
cout<<"masukkan luas alas = ";cin>>la;
cout<<"masukkan tinggi = ";cin>>t;
cout<<endl;
vl=la*t/3;
cout<<"volume limas = "<<vl;
getch();
return 0;
}
void main()
{
int pil;
do{
clrscr();
cout<<"menghitung volume"<<endl<<endl;
cout<<"+++++++++++++++++++++++++"<<endl;
cout<<"1=menghitung volume bola "<<endl;
cout<<"2=menghitung volume kubus"<<endl;
cout<<"3=menghitung volume limas"<<endl;
cout<<"4=keluar"<<endl;
cout<<"+++++++++++++++++++++++++"<<endl;
cout<<"masukkan pilihan = ";cin>>pil;
switch (pil){
case 1:
volume_bola();
break;
case 2:
volume_kubus();
break;
case 3:
volume_limas();
break;
case 4:
cout<<"\n\nprogram selesai";
break;
default :
cout<<"\n\nmaaf, pilihan tidak tersedia ";
break;
}
getch();
}
while (pil !=4);
}
Langganan:
Posting Komentar (Atom)
good artikel bos :D
BalasHapusthanx gan mohon pencerahannya. !
Hapus