Created
December 26, 2011 15:50
-
-
Save anonymous/1521469 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <conio.h> | |
# define phi 3.14 | |
void main() | |
{ | |
using namespace std; | |
char ulangi; | |
int kode; | |
int luas_persegi,sisi; | |
float luas_lingkaran,jari_jari; | |
int luas_segitiga,alas,tinggi; | |
do | |
{ | |
cout<<" Pilih Program Yang Ingin Dijalankan! "<<endl; | |
cout<<" 1. Luas Persegi "<<endl; | |
cout<<" 2. Luas Lingkaran. "<<endl; | |
cout<<" 3. Luas Segitiga. "<<endl; | |
cout<<"\nMasukan Kode Program"; | |
cin>>kode; | |
if (kode==1) | |
{ cout<<"\nMasukan Sisi Persesgi = "; | |
cin>>sisi; | |
luas_persegi = sisi*sisi; | |
cout<<"Luas Persegi = "<<luas_persegi<<endl; | |
} | |
else if (kode==2) | |
{ cout<<"\nMasukan jari-jari Lingkaran = "; | |
cin>>jari_jari; | |
luas_lingkaran=phi*jari_jari*jari_jari; | |
cout<<"Luas Lingkaran = "<<luas_lingkaran<<endl; | |
} | |
else if (kode==3) | |
{ cout<<"\nMasukan Tinggi segitiga = ";cin>>tinggi; | |
cout<<"Masukan Pajang alas Segitiga = ";cin>>alas; | |
luas_segitiga=(tinggi*alas)/2; | |
cout<<"Luas Segitiga = "<<luas_segitiga; | |
} | |
else cout<<"\nKode yang anda masukan salah !"; | |
getch(); | |
cout<<"apakah anda ingin megulanginya[y/t]:"; | |
cin>>ulangi; | |
} | |
while (ulangi=='y'||ulangi=='Y'); | |
getche (); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment