#include<iostream>
#include<conio.h>
using namespace std;
enum BOOLEAN { FALSE, TRUE };
void Segitiga(){
int a, t, L;
cout<<"Luas Segitiga " <<endl<<"--------------------"<<endl;
cout<<"Panjang Alas= "; cin>>a;
cout<<"\nTinggi = "; cin>>t;
L = (a*t)/2;
cout<<"\Luas = "<<L<<endl;
cout<<"--------------------------"<<endl;
}
void Bujursangkar(){
int s, L;
cout<<"Luas Bujursangkar " <<endl<<"--------------------"<<endl;
cout<<"Panjang Sisi= "; cin>>s;
L = s*s;
cout<<"\Luas = "<<L<<endl;
}
int main(){
int menu;
cout <<" Menu Program "<<endl<<"-----------------------"<<endl;
cout <<"[1] LUAS SEGITIGA "<<endl;
cout <<"[2] LUAS BUJURSANGKAR "<<endl;
cout <<"[0] KELUAR MENU "<<endl<<"-----------------------"<<endl;
while (TRUE) {
cout<<"\nMasukkan pilihan menu : "; cin>>menu; cout<<endl;
system("cls");
if(menu==1){
Segitiga();
}
else if(menu==2) {
Bujursangkar();
}
else if(menu==0) {exit(0);}
else {cout <<"Pilihan hanya 1 , 2 atau 0"; }
}
system ("pause");
}
Output Program:About Elmirakom
This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
0 comments:
Post a Comment