Pages

Friday, March 24, 2017

Script C++ Percabangan

dibawah ini adalah scrip program C++, tugas kuliah yang saya buat untuk memenuhi nilai akhir semester.
kalian bisa copy script dibawah ini.
semoga berhasil dan membantu tugas kalian,,
Software dapat di Download disini





  • #include "iostream.h"
    #include "conio.h"
    #include "windows.h"
    main(){
    int pilih;
    char nama [30];
    float Li,r,Lp,p,l,Ls,a,t;
    const float phi=3.14;
    cout<<"=========================\n";
    cout<<" PROGRAM MENU HITUNG\n";
    cout<<"=========================\n";
    cout<<"1.Hitung Luas Lingkaran\n";
    cout<<"2.Hitung Luas Persegi\n";
    cout<<"3.Hitung Luas Segitiga\n";
    cout<<"4.Keluar\n";
    cout<<"=========================\n\n";
    cout<<"Nama Anda :";
    cin>>nama;
    cout<<"\nSelamat Datang ["<

  • cout<<"] di Aplikasi Menghitung\n\n\n";
    while(pilih>=0){
    cout<<"Pilihan Anda (1/2/3/4) :";
    cin>>pilih;
    switch(pilih){
                            case 1:
                            cout<<"=================================\n";
                            cout<<" Menghitung Luas Lingkaran\n";
                           cout<<"=================================\n";
                            cout<<"Masukan jari - jari :";
                           cin>>r;
                            Li=phi*r*r;
                            cout<<"Luas Lingkaran adalah :"<





  •                        cout<<"---------------------------------\n\n\n";
                            break;
                                                    case 2:
                                                    cout<<"================================\n";
                                                    cout<<" Menghitung Luas Persegi\n";
                                                 cout<<"================================\n";
                                                  cout<<"Masukan Panjang Persegi :";
                                                 cin>>p;
                                                  cout<<"Masukan Lebar Persegi :";
                                                  cin>>l;
                                                 Lp=p*l;
                                                 cout<<"Hasil Luas Persegi Adalah :"<
                                                   cout<<"--------------------------------\n\n\n";
                                                 break;
                         case 3:
                        cout<<"==================================\n";
                        cout<<" Menghitung Luas Segitiga\n";
                        cout<<"==================================\n";
                        cout<<"Masukan Alas Segitiga :";
                        cin>>a;
                        cout<<"masukan Tinggi Segitiga :";
                        cin>>t;
                        Ls=0.5*a*t;
                        cout<<"Hasil Luas Segitiga Adalah :"<
                        cout<<"----------------------------------\n\n\n";
                        break;
                                                case 4:
                                              cout<<"================================\n";
                                              cout<<">>  TRIMAKASIH                <<                                                                  \n";
                                              cout<<"================================\n";
                                              break;
                        default:
                cout<<"KODE YANG ANDA MASUKAN SALAH !!!!!!\n";
                }
                }
    getch();
    }

    No comments:

    Post a Comment