#include "stdio.h"
#include "conio.h"
#include "iostream.h"
void main(){
int p,l,s,pil,r;
float ls,vol;
do {
clrscr();
gotoxy(20,5);cout<<"menu";
gotoxy(20,6);cout<<"1.hitung volume";
gotoxy(20,7);cout<<"2.hitung luas lingkaran";
gotoxy(20,8);cout<<"3.hitung luas pp";
gotoxy(20,9);cout<<"4.keliling lingkarang";
gotoxy(20,10);cout<<"5.keliling persegi panjang";
gotoxy(20,11);cout<<"6.keluar";
gotoxy(20,12);cout<<"pilihan:";cin>>pil;
clrscr();
switch(pil){
case 1:
gotoxy(20,5);cout<<"hitung volume";
gotoxy(20,6);cout<<"sisi";
cin>>s;
vol=s*s*s;
gotoxy(20,7);cout<<"volume:"<<vol;
break;
case 2:
gotoxy(20,5);cout<<"hitung luas lingkaran";
gotoxy(20,6);cout<<"jari-jari";
cin>>r;
ls=3.14*r*r;
gotoxy(20,7);cout<<"luas lingkaran:"<<ls;
break;
case 3:
gotoxy(20,5);cout<<"hitung luas persegi panjang";
gotoxy(20,6);cout<<"panjang";cin>>p;
gotoxy(20,7);cout<<"lebar";cin>>l;
ls=p*l;
gotoxy(20,8);cout<<"luas persegi panjang:"<<ls;
break;
case 4:
gotoxy(20,5);cout<<"keliling lingkaran";
gotoxy(20,6);cout<<"jari-jari";cin>>r;
ls=2*3.14*r;
gotoxy(20,7);cout<<"lingkaran"<<l;
break;
case 5:
gotoxy(20,5);cout<<"keliling persegi panjang";
gotoxy(20,6);cout<<"panjang";cin>>p;
gotoxy(20,7);cout<<"lebar";cin>>l;
ls=2*p+2l;
gotoxy(20,8);cout<<"keliling persegi panjang"<<ls;
break;
}
getche();
}while(pil !=6);
}
Tugas Ke 2. Menghitung p,l,s,pil,r; Lingkaran Dan Persegi Panjang
19.22
Hendra
Posted in
Langganan:
Posting Komentar (Atom)
No Response to "Tugas Ke 2. Menghitung p,l,s,pil,r; Lingkaran Dan Persegi Panjang"
Posting Komentar