SHARE
TWEET

NilaiAkhirSeleksiLoopArray

makassar09876 Dec 18th, 2018 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6. void awal ()
  7.     {
  8.           cout<<" --------------------------------------------------------------- "<<endl;
  9.           cout<<"                 PROGRAM MENCARI NILAI AKHIR       "<<endl;
  10.           cout<<" --------------------------------------------------------------- "<<endl;
  11.     }
  12. void tampilan ()
  13.     {
  14.         cout<<" ============= HASILNYA ============="<<endl;  
  15.     }
  16. void terakhir ()
  17.     {
  18.           cout<<" --------------------------------------------------------------- "<<endl;
  19.     }
  20.  
  21.  
  22. int main()
  23. {
  24.     int i;
  25.     int jum;
  26.     char ulang;
  27.     char nama[50][100],nim[20],nh;
  28.     int nilai_mid[10];
  29.     float nilai_smstr[10];
  30.     float nilai_akhir[10];
  31.    
  32.     do
  33.     {
  34.         awal ();        // digunakan untuk memanggil program awal
  35.         cout<<" Masukkan Jumlah mahasiswa = ";cin>>jum;
  36.         cout<<endl;
  37.         terakhir ();     // digunakan untuk memanggil program terakhir
  38.        
  39.         for (i=1;i<=jum;i++)
  40.         {
  41.             cout<<" Mahasiswa ke - "<<i<<endl;
  42.             cout<<" Nama Mahasiswa  = ";cin>>nama[i];
  43.             cout<<" Nilai MID       = ";cin>>nilai_mid[i];
  44.             cout<<" Nilai SEMESTER  = ";cin>>nilai_smstr[i];
  45.             nilai_akhir [i]=(0.4*nilai_mid[i])+(0.6*nilai_smstr[i]);
  46.             strupr (nama[i]);
  47.             cout<<endl;
  48.         }
  49.         cout<<endl;
  50.         tampilan ();   // digunakan untuk memanggil program tampilan
  51.        
  52.         for (i=1;i<=jum;i++)
  53.         {
  54.             cout<<endl;
  55.             cout<<"Mahasiswa ke :"<<i<<endl;
  56.             cout<<"Nama Mahasiswa :"<<nama[i]<<endl;
  57.             cout<<"Nilai MID :"<<nilai_mid [i]<<endl;
  58.             cout<<"Nilai Semester :"<<nilai_smstr [i]<<endl;
  59.             cout<<"Nilai Akhir :"<<nilai_akhir [i]<<endl;
  60.            
  61.             if (nilai_akhir[i]>=80)
  62.                cout<<"Nilai Huruf : A";
  63.             else if (nilai_akhir[i]>=70)
  64.                  cout<<"Nilai Huruf : B";
  65.             else if (nilai_akhir[i]>=55)
  66.                  cout<<"Nilai Huruf : C";
  67.             else if (nilai_akhir[i]>=40)
  68.                  cout<<"Nilai Huruf : D";
  69.             else if (nilai_akhir[i]<=39)
  70.                  cout<<"Nilai Huruf : E";
  71.            
  72.             cout<<endl;
  73.         }
  74.         cout<<" --------------------------------------------------------------- "<<endl;
  75.         cout<<endl;
  76.         cout<<" Ulang Kembali ( Y/T )? ";       //pilihan perulangan
  77.         cin>>ulang;
  78.         system ("cls");       // digunakan untuk menghapus program yang ada di atasnya
  79.     }
  80.         while ((ulang=='Y')||(ulang=='y'));
  81.      
  82.         cout<<endl<<endl;
  83. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top