Studi kasus:
- 2 inputan
- mata kuliah
- total sks
#include<iostream>
using namespace std;
main(){
int sks[10],tot=0,d,a; // deklarasi variabel
char mk[20][10];// [20] karakter dan 10 data
cout<<"--------------------------------------"<<endl;
cout<<"Input Jumlah data: ";cin>>a;
cout<<"--------------------------------------"<<endl;
for(int i=0; i<a; i++){
cout<<"Masukan Mata Kuliah: "; cin>>mk[i];
cout<<"Masukan SKS : "; cin>>sks[i];
tot+=sks[i];
}
cout<<"--------------------------------------"<<endl;
cout<<"Total SKS adalah: "<<tot<<endl;
cout<<"--------------------------------------"<<endl;
}
More From Author
Algoritma dan Pemrograman