#include <iostream>
using namespace std;
void garis() {
cout << "========================================\n";
}
void judul() {
garis();
cout << "\tContoh Program Array\n";
garis();
}
void author() {
cout << "Nama : Dhafin Shabir Alfatih\n";
cout << "Email : dhafinshabir610@gmail.com\n";
}
int main() {
int jml;
judul();
cout << "Masukan Jumlah Data : ";
cin >> jml; cout << endl;
// Deklarasi array
int absen[jml], tugas[jml], uts[jml], uas[jml];
float total[jml];
// Input data
for (int i = 0; i < jml; i++) {
garis();
cout << "Data ke-" << i + 1 << endl;
cout << "Masukan Nilai Absen : "<<endl;
cin >> absen[i];
cout << "Masukan Nilai Tugas : "<<endl;
cin >> tugas[i];
cout << "Masukan Nilai UTS : "<<endl;
cin >> uts[i];
cout << "Masukan Nilai UAS : "<<endl;
cin >> uas[i];
total[i] = (absen[i] * 0.1) + (tugas[i] * 0.2) + (uts[i] * 0.3) + (uas[i] * 0.4);
}
garis();
cout << "Data Yang Anda Masukan\n";
garis();
cout << "No Absen Tugas UTS UAS Total\n";
garis();
for (int i = 0; i < jml; i++) {
cout << i + 1 << " ";
cout << absen[i] << " ";
cout << tugas[i] << " ";
cout << uts[i] << " ";
cout << uas[i] << " ";
cout << total[i] << endl;
}
garis();
author();
return 0;
}