Cara Membuat
program mencari volume bangun ruang
Assalamualaikum
wr wb.
Teman-teman kali ini saya akan shering
tentang source code C++ yang hasilnya
adalah Mencari volume bangun ruang . Sebelum kita memasukan source codenya.
Kita harus membuat terlebih dahulu projectnya.Mari kita membuat .!!
Langkah-langkah
:
1. Pertama
bukalah Visual C++ nya , lalu buatlah project dan beri nama sesuka kalian. Lalu
klik ok.
2. Setelah
itu akan muncul tampilan seperti ini, agar lebih mudah dalam membuat
programnya, langsung saja klik finish.
3. Setelah
itu , setelah masuk di jendela awal. Langsung tuliskan source kode yang ada di
bawah ini
Source code
:
// Perhitungan Volume.cpp : Defines the entry point
for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int
pil, hasil, s, p, l, r, t, ulang=1;
while (
ulang == 1 )
{
cout
<< “ By : Alvin Cahya P” endl;
cout
<< " =================================== " << endl;
cout
<< " Perhitungan Volume
Bangun Ruang " << endl;
cout
<< " =================================== " << endl;
cout
<< " Manu Pilihan "<< endl;
cout
<< " [1] Volume Kubus " << endl;
cout
<< " [2] Volume balok " << endl;
cout
<< " [3] Volume prisma segiempat " << endl;
cout
<< " [4] Volume Tabung " << endl;
cout
<< " [5] Volume Bola " << endl;
cout
<< " [6] Volume limas segiempat " << endl;
cout
<< " [7] Volume kerucut " << endl;
cout
<< endl;
cout
<< " Pilihan Anda : " ;
cin
>> pil;
switch(pil)
{
case 1:
cout
<< " ------------------------------- " << endl;
cout
<< " Volume Kubus " << endl;
cout
<< " ============= " << endl;
cout
<< " s = " ;
cin
>> s;
hasil
= s * s * s ;
cout
<< " hasil= " << hasil << endl ;
break;
case 2:
cout
<< " --------------------- " << endl;
cout
<< " Volume Balok " << endl;
cout
<< " ============= " << endl;
cout
<< " p = " ;
cin
>> p;
cout
<< " l = " ;
cin
>> l;
cout
<< " t = " ;
cin
>> t;
hasil
= p * l * t ;
cout
<< " hasil= " << hasil << endl ;
break;
case 3:
cout
<< " --------------------- " << endl;
cout
<< " Volume prisma segiempat " << endl;
cout
<< " ======================= " << endl;
cout
<< " s = " ;
cin
>> s;
cout
<< " t = " ;
cin
>> t;
hasil
= s * s * t ;
cout
<< " hasil= " << hasil << endl ;
break;
case 4:
cout
<< " --------------------- " << endl;
cout
<< " Volume Tabung " << endl;
cout
<< " ============== " << endl;
cout
<< " r = " ;
cin
>> r ;
cout
<< " t = " ;
cin
>> t ;
hasil
= 3.14 * r * r * t ;
cout
<< " hasil= " << hasil << endl ;
break;
case 5:
cout
<< " --------------------- " << endl;
cout
<< " Volume Bola "
<< endl;
cout
<< " ============== " << endl;
cout
<< " r = " ;
cin
>> r ;
hasil
= 1.3 * 3.14 * r * r * r ;
cout
<< " hasil= " << hasil << endl ;
break;
case 6:
cout
<< " --------------------- " << endl;
cout
<< " Volume Limas Segiempat " << endl;
cout
<< " ======================= " << endl;
cout
<< " s = " ;
cin
>> s;
cout
<< " t = " ;
cin
>> t;
hasil
= 0.3 * s * s * t ;
cout
<< " hasil= " << hasil << endl ;
break;
case 7:
cout
<< " --------------------- " << endl;
cout
<< " Volume Kerucut "
<< endl;
cout
<< " =============== " << endl;
cout
<< " r = " ;
cin
>> r ;
cout
<< " t = " ;
cin
>> t ;
hasil
= 0.3 * 3.14 * r * r * t ;
cout
<< " hasil= " << hasil << endl ;
default:
break;
}
cout
<< ( "Apakah Anda ingin mengulang ? (1/0)" ) ;
cin
>> ulang;
ulang=ulang;
}
system("pause");
return
0;
}
inilha
source codenya teman-teman dan ini lah hasilnya,:
nah di atas adalah hasilnya teman-teman . ok, terimakasih telah berkunjung
di blog saya. Dan jangan lupa join ya di blog saya . makasih :D
wassalamualaikum wr. wb
Tatanium Bingo - Tatanium Art Museum
BalasHapusTatanium titanium ore terraria Bingo, Tatanium, Tatanium, Tatanium, titanium engine block Tatanium, titanium network surf freely Tatanium, Tatanium titanium vs stainless steel apple watch Bingo, titanium nitride coating service near me Tatanium.