Cute Rocking Baby Monkey Naning Destanti: MENGHITUNG LUAS PERSEGI , PERSEGI PANJANG, DAN LINGKARAN DENGAN C++

Jumat, 27 September 2013

MENGHITUNG LUAS PERSEGI , PERSEGI PANJANG, DAN LINGKARAN DENGAN C++



 MENGHITUNG LUAS PERSEGI , PERSEGI PANJANG,  DAN LINGKARAN DENGAN C++

#include <iostream.h>
#include <conio.h>


void main() {
                int i, n, angka, pilihan;
                float sisi=0, panjang=0, lebar=0, jari=0, luas=0;


                cout << "pilih salah satu :\n"
                                << "1. Menghitung Luas Persegi\n"
                                << "2. Menghitung luas Persegi panjang\n"
                                << "3. Menghitung Luas Lingkaran \n"
                                << "4. Keluar dari program\n\pilihan : ";

                cin >> pilihan;

                switch (pilihan) {
                                case 1:
                                clrscr() ;
                                                cout << "Masukkan sisi : ";
                                                cin >> sisi;
                                                luas = sisi * sisi;
                                                cout<<"Luas Persegi : "<<luas;
                                                getch() ;
                                                case 2:
                                                                clrscr();
                                                                cout << "masukkan panjang : ";
                                                                cin>>panjang;
                                                                cout <<"masukkan lebar : ";
                                                                cin>>lebar;
                                                                luas = panjang * lebar ;
                                                                cout << "Luas persegi panjang: " << luas;
                                                                getch();
                                                case 3 :
                                                                clrscr();
                                                                cout << "masukkan jari-jari : ";
                                                                cin>>jari;
                                                                luas = 3.14 * jari * jari;
                                                                cout << "Luas lingkaran : " << luas;
                                                                getch();
                                                case 4:
                                                                break;
                                                                default :
                                                                                getch();
                                                                cout << "inputan anda salah";
}

}

Tidak ada komentar:

Posting Komentar