Wednesday, 17 June 2020

Program Nilai Siswa

#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <iomanip>
using namespace std;
int main()
{
    string nama_siswa[25],nama_mapel[25],kelas[10],ket[15];
    int kode_mapel[5],nilai[20],nilai_akhir[20],nis[5],alpa[5],ijin[5],sakit[20],jum_mapel[20];
    int z,n;
    char lagi;
    atas :
    cout<<"                                  Program Menghitung Nilai Akhir Siswa "<<endl;
    cout<<" -------------------------------------------------------------------------------------------------------- "<<endl;
   

    cout<<"Masukan Jumlah Data : "; cin>>n;  
    cout<<"Nama Siswa    : ";cin>>nama_siswa[z];
    cout<<"NIS           : ";cin>>nis[z];
    cout<<"Kelas         : ";cin>>kelas[z];
   
    for (int z=1;z<=n;z++){
    cout<<"No urut       : " <<z;cout<<endl;
    cout<<"Kode Mapel    : ";cin>>kode_mapel[z];
    cout<<"Nama Mapel    : ";cin>>nama_mapel[z];
    cout<<"Nilai         : ";cin>>nilai[z];
    nilai_akhir[z]=nilai_akhir[z]+nilai[z];
  
    cout<<"Alpa          : ";cin>>alpa[z];
    cout<<"Ijin          : ";cin>>ijin[z];
    cout<<"Sakit         : ";cin>>sakit[z];
{
  
    if (alpa[z]==0, ijin[z]==0, sakit[z]==0)
    {ket[z]='Sangat Baik';
    ket[z]="Sangat Baik";}
    else if (alpa[z]>=1 && alpa[z]<=2|| ijin[z]>=1 && ijin[z]<=2 ||sakit[z]>=1 && sakit[z]<=2)
    {ket[z]='Baik';
    ket[z]="Baik";}
    else if (alpa[z]>=4 && alpa[z]<=6|| ijin[z]>=4 && ijin[z]<=6 ||sakit[z]>=4 && sakit[z]<=6)
    {ket[z]='Kurang Baik';
    ket[z]="Kurang Baik";}
    else if (alpa[z]>6 || ijin[z]>6 || sakit[z]>6)
     {ket[z]='Sangat Buruk';
     ket[z]="Sangat Buruk";}
}
   
}
system("cls);
cout<<"==============================================================================================="<<endl;
    cout<<"Nama Siswa : " << nama_siswa[z]<<endl;
    cout<<"NIS        : " << nis[z]<<endl;
    cout<<"Kelas      : " << kelas[z]<<endl;

    cout<<"                  Program Menghitung Nilai Akhir Siswa"<<endl;
    cout<<"*******************************************************************************************"<<endl;     
    cout<<"==========================================================================================="<<endl;
    cout<<"| No | NAMA MAPEL    |  ALPA | IJIN | SAKIT |      KETERANGAN     |      NILAI AKHIR      |"<<endl;
    cout<<"==========================================================================================="<<endl;
     
     
     
      for (z=1;z<=n;z++)
      {
            cout<<"|"<<setw(4);cout<<z; 
            cout<<"|"<<setw(15);cout<< nama_mapel[z];
            cout<<"|"<<setw(7);cout<< alpa[z];   
            cout<<"|"<<setw(6);cout<< ijin[z];
            cout<<"|"<<setw(7);cout<< sakit[z];
            cout<<"|"<<setw(21);cout<< ket[z];
            cout<<"|"<<setw(23);cout<< nilai_akhir[z];
            cout<<"|"<<endl;
                 
                     
      }   
           
           
    cout <<endl;
    cout<<"Ingin Menambahkan Data Lagi [Y/N] : ";cin>>lagi;
    if(lagi=='Y'||lagi=='y')
    goto atas;
    return 0;
}

No comments:

Post a Comment