Monday, 4 December 2023

Program Nilai Siswa

 #include<conio.h>

#include<stdio.h>

#include<iostream>

#include<iomanip>

using namespace std;

int main() {

    int n,i;

    string nama_sklh, alamat, website, ket[20], nama[20];

    int no_hp, nis[20], alpa[20], sakit[20], ijin[20], tugas[20], uts[20], uas[20], NA[20];

cout << "Masukan Nama Sekolah : ";getline(cin, nama_sklh);

    cout << "Masukan Alamat: ";getline(cin, alamat);

    cout << "Masukan no_hp : ";cin >> no_hp;

    cout << "Masukan Website: ";cin >> website;

    cout << "Masukan Jumlah Siswa : ";cin >> n;

    for (i = 0; i < n; i++)

{

        cout << "Data Ke- " << i+1 <<endl;

        cout << "Nama: "; cin >> nama[i];

        cout << "NIS: "; cin >> nis[i];

        cout << "Alpa berapa kali : ";cin>>alpa[i];

cout << "Ijin berapa kali : ";cin>>ijin[i];

cout << "sakit berapa kali : ";cin>>sakit[i];

cout << "Nilai tugas : ";cin>>tugas[i];

cout << "Nilai UTS : ";cin>>uts[i];

cout << "Nilai UAS: ";cin>>uas[i];

        cout << endl;

        NA[i] = uts[i]*0.3 + tugas[i]*0.3 + uas[i]*0.4;

if (ijin[i]>2 && alpa[i]>2 && sakit[i]>2)

{

ket[i] = "Buruk";

        }

else if (ijin[i]>1 && alpa[i]>2 && sakit[i]>1)

{

            ket[i] = "Kurang Baik";

        }

else if (ijin[i]>1 && alpa[i]>0 && sakit[i]>0)

  {

    ket[i] = "Baik";

        } 

        else

        {

        ket[i] = "Sangat Baik";

}

    }

    system("cls");

    cout<<"  Nama Sekolah : "<<nama_sklh<<endl;

    cout<<"  Alamat : "<<alamat<<endl;

cout<<"  Website: "<<website<<endl;

cout<<"  No HP: "<<no_hp<<endl;

cout << "===============================================================================================" << endl;

    cout<<"No ";

cout<<"  Nama ";

cout<<"            NIS";

cout<<"     Alpa ";

cout<<"   Ijin";

cout<<"   Sakit";

cout<<"   Tugas";

cout<<"    UTS";

cout<<"        UAS ";

cout<<"      Ket "<<endl;

    cout << "===============================================================================================" << endl;

    for (i = 0; i < n; i++) 

{

        cout << setiosflags(ios::left) << setw(4) << i + 1;

        cout << setprecision(2) << " " << setw(15) << nama[i];

        cout << setprecision(2) << "  " << setw(9) << nis[i];

        cout << setprecision(2) << "  " << setw(2) << alpa[i];

        cout << setprecision(2) << "      " << setw(2) << ijin[i];

        cout << setprecision(2) << "     " << setw(2) << sakit[i];

        cout << setprecision(2) << "   " << setw(3) <<tugas[i];

        cout << setprecision(2) << "       " << setw(3) <<uts[i];

        cout << setprecision(2) << "        " <<setw(3)<< uas[i];

cout << setprecision(2) << "        " <<setw(10)<< ket[i]<<endl ;

    }

    cout << "================================================================================================" << endl;

}

No comments:

Post a Comment