Program Hitung Luas dan Volume dengan Dev c++ - Ade Wahyudin

Senin, 19 Oktober 2015

Program Hitung Luas dan Volume dengan Dev c++

                                   "PROGRAM HITUNG LUAS DAN VOLUME C++ DENGAN
                                                            MENGGUNAKAN DEV C++"


#include <iostream>
#include <stdlib.h>
#include <conio.h>
float phi=3.14;
using namespace std;

int main()
{
    int iter=0, pil, a, b, c;
    float volume, luas;
    bool loop=true;

    while(loop)
    {
        system("cls");
        cout << "              -----------------------------------------------------             "<< endl;
        cout << "              |         Selamat datang di program hitung          |             "<< endl;
        cout << "              |                     Dev C++                       |             "<< endl;
        cout << "              -----------------------------------------------------             ";
        cout << "              | Pilihan Menu :                                    |              ";
        cout << "             ----------------                                                   ";
        cout << "             |1) Limas Segi Empat                                |"<< endl;
        cout << "              |2) Tabung                                          |"<< endl;
        cout << "              |3) Jajar Genjang                                   |"<< endl;
        cout << "              |0) Keluar dari program                             |"<< endl;
        cout << "              -----------------------------------------------------             ";
        cout << "              | Silahkan masukkan angka pilihan anda -> ";
        cin >> pil;
        cout << endl;
        cout << endl;

        switch(pil)
        {
        case 1:
            cout << "              -----------------------------------------------------" << endl;
            cout << "              Perhitungan Volume dan Luas Permukaan Limas Segi Empat" << endl;
            cout << "              -----------------------------------------------------" << endl;
            cout << endl;
            cout << "              ->Panjang alas limas = ";
            cin >> a;
            cout << "              ->Lebar alas limas   = ";
            cin >> b;
            cout << "              ->Tinggi limas       = ";
            cin >> c;
            volume = (a * b * c * 1/3);
            luas = ((a + b) * c) + (a * b);
            cout << "              ->Volume             = " << volume << endl;
            cout << "              ->Luas permukaan     = " << luas << endl;
            cout << "              -----------------------------------------------------" ;
            cout << endl;
            cout << endl;
            cout << "Tekan Enter Untuk Kembali Ke Menu Awal !"<<endl;
            getch () ;
            break;
        case 2:
            cout << "              -----------------------------------------------------" << endl;
            cout << "              Perhitungan Volume dan Luas Permukaan Tabung"          << endl;
            cout << "              -----------------------------------------------------" << endl;
            cout << endl ;
            cout << "              ->Panjang jari-jari alas tabung = ";
            cin >> a;
            cout << "              ->Tinggi tabung                 = ";
            cin >> b;
            volume = phi * a * a * b;
            luas = (phi * a * 2) * (b * a);
            cout << "              ->Volume                        = " << volume << endl;
            cout << "              ->Luas permukaan                = " << luas << endl;
            cout << "              -----------------------------------------------------" ;
            cout << endl;
            cout << endl;
            cout << "Tekan Enter Untuk Kembali Ke Menu Awal !"<<endl;
            break;
        case 3:
            cout << "              -----------------------------------------------------" << endl;
            cout << "              Perhitungan Luas Jajar Genjang"                        << endl;
            cout << "              -----------------------------------------------------" << endl;
            cout << endl ;
            cout << "              ->Luas Alas          = ";
            cin >> a;
            cout << "              ->Tinggi Alas        = ";
            cin >> b;
            luas = a * b;
            cout << "              ->Luas Jajar Genjang = " << luas << endl;
            cout << "              -----------------------------------------------------" ;
            cout << endl;
            cout << endl;
            cout << "Tekan Enter Untuk Kembali Ke Menu Awal !"<<endl;
            break;
           
           
        case 0:
            loop = false;
           
            default : cout <<"                         ------- TERIMA KASIH --------           " <<endl ;
            cout << endl;
             break;
           
        }

        getch();
    }
   
}




*Klik Compile(F9) , Run(F10), Compile and Run(F11)
Hasil Setelah Di Compile and Run !


Cukup Sekian penjelasan saya tentang mengenai Program Hitung Luas dan Volume. Semoga bermanfaat . Terima kasih 






















Tidak ada komentar:

Posting Komentar