Program c++ rumus bangun ruang dan konversi suhu dengan function

berikut ini akan di sajikan rumus program untuk mencari berbagai operasi bangun ruang, mencari luas prapesium, volume trapesium, kerucut, bola dan lain-lain.
juga ada rumus untuk konversi suhu, pokoknya anda tinggal copas langsung jadi, tidak usah puzing-puzing, cukup kami yang puzing, hehehee
Selamat menikmati hidangan kami……………………..

#include <iostream.h>

#include <conio.h>

#include <math.h>

void limas()
{
double v,l,t,s,sm,lbwh,lats,sd;
cout<<“Menghitung Sisi Miring, Luas & Volum Limas Segi Enam”<<endl;
cout<<“—————————————————-“<<endl<<endl;
cout<<“masukkan panjang sisi :”;cin>>s;
cout<<“masukan tinggi Limas :”;cin>>t;

sd=sqrt((s*s)-((0.5*s)*(0.5*s))); sm=sqrt((sd*sd)+(t*t));
cout<<“Sisi miring : “<<sm<<endl;
lbwh=6*(0.5*s*sd);
lats=6*(0.5*s*sm);
l=lbwh+lats;
cout<<“luas limas : “<<l<<endl;
v=0.33*lbwh*t;
cout<<“volume limas : “<<v<<endl;
}

void prisma()
{double v,l,t,s,sd,la,ls;
cout<<“Menghitung Sisi Miring, Luas & Volume Prisma Segi Enam”<<endl;
cout<<“——————————————————“<<endl<<endl;
cout<<“masukkan sisi : “;cin>>s;
cout<<“masukkan tinggi Prisma : “;cin>>t;
sd=sqrt((s*s)-((0.5*s)*(0.5*s)));
la=6*(0.5*s*sd);
ls=s*t;
l=(2*la)+(6*ls);
v=la*t;
cout<<“Luas prisma : “<<l<<endl; cout<<“Volume prisma : “<<v<<endl;
}

void trapesium()
{
double vp,lp,tt,tp,spjg,spdk,la;
double lsb,lsd,lss,sm;
cout<<“Menghitung sisi miring, luas & volume Prisma Trapesium Sama Sisi”<<endl;
cout<<“—————————————————————-“<<endl<<endl; cout<<“masukkan sisi panjang : “;cin>>spjg;
cout<<“masukkan sisi pendek : “;cin>>spdk;
cout<<“Masukkan tinggi trapesium : “;cin>>tt;
cout<<“Masukkan tinggi prisma : “;cin>>tp;
sm=sqrt((((spjg-spdk)/2)*((spjg-spdk)/2))+(tt*tt)); cout<<“sisi miring : “<<sm<<endl;
la=0.5*(spjg+spdk)*tt;
lss=2*(tp*sm);
lsd=spjg*tp;
lsb=spdk*tp;
lp=2*la+lss+lsd+lsb;
cout<<“luas prisma : “<<lp<<endl;
vp=la*tp;
cout<<“volume prisma : “<<vp;
}

void bola()
{
double v,l,r;
cout<<“Menghitung Luas & Volume Bola”<<endl;
cout<<“—————————–“<<endl<<endl;
cout<<“masukan jari2 : “;cin>>r;
l=4*3.14*r*r;
cout <<“luas Bola : “<<l<<endl;
v=4*3.14*r*r*r/3;
cout <<“Volume Bola : “<<v;
}

void tabung(){
double v,l,r,t;
cout<<“Menghitung Luas & Volume Tabung”<<endl;
cout<<“——————————-“<<endl<<endl;
cout<<“Masukan Jari2 :”;cin>>r;
cout<<“masukan Tinggi :”;cin>>t;
l=(2*3.14*r*r)+(2*3.14*r*t);
cout <<“luas Tabung : “<<l<<endl;
v=3.14*r*r*t;
cout <<“Volume Tabung : “<<v;
}

void crf()
{double c,r,f;
cout<<“Konversi Celcius ke Reamur & Fahrenhait”<<endl;
cout<<“—————————————“<<endl<<endl;
cout<<“masukkan nilai celcius: “;cin>>c;
r=4*c/5;
f=(9*c/5)+32;
cout<<“Reamur : “<<r<<endl;
cout<<“Fahrenhait : “<<f;
}

void rcf()
{
double r,c,f;
cout<<“Konversi Reamur ke Celcius & Fahrenhait”<<endl;
cout<<“—————————————“<<endl<<endl;
cout<<“masukkan nilai Reamur : “;cin>>r; c=5*r/4;
f=(9*r/4)+32;
cout<<“celcius : “<<c<<endl;
cout<<“Fahrenhait : “<<f;
}

void fcr()
{
double c,r,f;
cout<<“Konversi Fahrenhait ke Celcius & Reamur”<<endl;
cout<<“—————————————“<<endl<<endl;
cout<<“masukkan nilai farenheit: “;cin>>f;
c=(f-32)*5/9;
r=(f-32)*4/9;
cout<<“celcius : “<<c<<endl;
cout<<“reamur : “<<r;
}void rk()
{
double r,k;
cout<<“Konversi Reamur ke Kelvin “<<endl;
cout<<“————————–“<<endl<<endl;
cout<<“masukkan nilai reamur: “;cin>>r;
k=(5*r/4)+273;
cout<<“kelvin : “<<k;
}

void kr()
{
double r,k;
cout<<“Konversi Kelvin ke Reamur “<<endl; cout<<“————————–“<<endl<<endl;
cout<<“masukkan nilai kelvin: “;cin>>k;
r=(k-273)*4/5;
cout<<“reamur : “<<r;
}
void main(){
int menu;
int submenu;

do{

clrscr();
cout<<“—————Menu Utama—————“<<endl; cout<<“1. Bangun Ruang “<<endl;
cout<<“2. Konversi Suhu “<<endl;
cout<<“3. Keluar “<<endl;
cout<<“—————————————-“<<endl<<endl;
cout<<“Masukkan Pilihan :”;cin>>menu;
switch (menu){ case 1: do{
clrscr();
cout<<“———————-Pilihan Menu Bangun Ruang———————–“<<endl<<endl;
cout<<“1. Menghitung Sisi Miring, Luas & Volume Limas Segi Enam”<<endl;
cout<<“2. Menghitung Sisi Miring, Luas & Volume Prisma Segi Enam”<<endl; cout<<“3. Menghitung Sisi Miring, Luas & Volume Prisma Trapesium Sama Sisi”<<endl;
cout<<“4. Menghitung Luas & Volume Bola”<<endl;
cout<<“5. Menghitung Luas & Volume Tabung”<<endl;
cout<<“6. Kembali Ke Menu Utama “<<endl;
cout<<“———————————————————————-“<<endl<<endl;
cout<<“Masukkan Pilihan :”;cin>>submenu;

 
switch (submenu){
case 1: limas();break; case 2: prisma();break;
case 3: trapesium();break;
case 4: bola();break;
case 5: tabung();break;

} getch();
}while (submenu !=6);
break;

 

case 2:
do{
clrscr();
cout<<“———-pilihan Menu Konversi suhu———-“<<endl;
cout<<“1.konversi celcius ke reamur dan fahrenhait”<<endl;
cout<<“2.konversi reamur ke celcius dan fahrenhait”<<endl; cout<<“3.konversi fahrenhait ke celcius dan reamur “<<endl;
cout<<“4.konversi reamur ke kelvin”<<endl;
cout<<“5.konversi kelvin ke reamur”<<endl;
cout<<“6.kembali ke Menu Utama”<<endl;
cout<<“———————————————-“<<endl<<endl;
cout<<“Masukkan Pilihan :”;cin>>submenu;

switch (submenu){
case 1: crf();break;
case 2: rcf();break;
case 3: fcr();break; case 4: rk();break;
case 5: kr();break;

} getch();
}while (submenu !=6); break;
}
}while (menu !=3);

getch();
}

About irwantav

seperti yang anda lihat !!!

Posted on 23 Maret 2012, in c++ and tagged , , , . Bookmark the permalink. 2 Komentar.

  1. caranya gmn om?

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: