Tugas8.1

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <iomanip> using namespace std; // Nama : Alvian Rohmadi Anwari // Nim : 3420230007 int main() { int jumlahData; cout << "======================================" << endl; cout << " Contoh Program Array " << endl; cout << "======================================" << endl; cout << "Masukan Jumlah Data : " <<endl; cin >> jumlahData; int absen[jumlahData], tugas[jumlahData], uts[jumlahData], uas[jumlahData]; double total[jumlahData]; for (int i = 0; i < jumlahData; i++) { cout << "======================================" << endl; 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]; // Menghitung total (bobot contoh: absen 10%, tugas 20%, UTS 30%, UAS 40%) total[i] = (absen[i] * 0.1) + (tugas[i] * 0.2) + (uts[i] * 0.3) + (uas[i] * 0.4); } cout << "======================================" << endl; cout << "Data Yang Anda Masukan" << endl; cout << "======================================" << endl; cout << "No Absen Quis UTS UAS Total" << endl; for (int i = 0; i < jumlahData; i++) { cout << i + 1 << " " << absen[i] << " " << tugas[i] << " " << uts[i] << " " << uas[i] << " " << fixed << setprecision(2) << total[i] << endl; } cout << "======================================" << endl; cout << "Nama : Alvian Rohmadi Anwari" << endl; cout << "Email : alviangans123@gmail.com" << endl; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines