IP

Senin, 30 April 2012

PROGRAM C++ MENGHITUNG NILAI

 
#include <iostream>
using namespace std ;
int main()
{
                char choice ;
                cout << " Menu Utama " ; cout << endl ;
                cout << " 1. Program If IPK " ; cout << endl ;
                cout << " 2. Program Rata-rata Kelulusan " ; cout << endl << endl ;
                cout << " Your Choice = " ; 
                cin >> choice ;
                switch ( choice ) {
                                case '1' :
                                                double nilai;
                                                cout << " Masukkan Nilai IPK = " ; 
                                                cin >> nilai ;
                                                if ( nilai >= 2 && nilai <= 2.75 )
                                                                cout << " Lulus Memuaskan " << endl ;
                                                else
                                                                if ( nilai > 2.75 && nilai <= 3.50 )
                                                                                cout << " Lulus Sangat Memuaskan " << endl ;
                                                                else
                                                                                if ( nilai > 3.50 && nilai <= 4.00 )
                                                                                                cout << " Lulus Dengan Pujian " << endl ;
                                                                                else
                                                                                                cout << " Data IP tidak valid " << endl ;
                                                return 0 ;
                                                break ;
                                case '2' :
                                                int nilai_uts, nilai_uas, nilai_ujian_utama ;
                                                float hasil ;
                                                cout << " Masukkan Nilai UTS Anda = " ;
                                                cin >> nilai_uts ;
                                                cout << " Masukkan Nilai UAS Anda = " ;
                                                cin >> nilai_uas ;
                                                cout << " Masukkan Nilai Ujian Utama Anda = " ;
                                                cin >> nilai_ujian_utama  ;
                                                hasil = ( nilai_uts + nilai_uas + nilai_ujian_utama ) / 3 ;
                                                cout << hasil << endl ;
                                                break ;
                                default :
                                                cout << " Wrong Choice " << endl ;
                }
                return 0 ;
}

Output Program 1

Output Program 2 
Output Program 3





1 komentar:

Unknown mengatakan...

Terima kasih..

Posting Komentar

free counters