Created
October 12, 2022 11:13
-
-
Save oktavianto/5b92174ed3dae411d9688261fc06b88b to your computer and use it in GitHub Desktop.
Buatlah program untuk menginput data sebanyak 5 mahasiswa (menggunakan array of structure)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
struct mahasiswa{ | |
string nim; | |
string nama; | |
string jurusan; | |
}; | |
int main(){ | |
mahasiswa mhs[5]; | |
for(int i=0; i<5; i++){ | |
// [+] Input Data Masahasiswa ke - i [+] | |
cout << "[+] Masukkan Data Mahasiswa ke - " << i+1 << " [+]" << endl; | |
cout << "Masukkan NIM: "; | |
cin >> mhs[i].nim; | |
cout << "Masukkan Nama: "; | |
cin >> mhs[i].nama; | |
cout << "Masukkan Jurusan: "; | |
cin >> mhs[i].jurusan; | |
cout << "=========================" << endl; | |
} | |
cout << "NIM\tNama\tJurusan" << endl; | |
for(int i=0; i<5; i++){ | |
cout << mhs[i].nim << "\t" << mhs[i].nama << "\t" << mhs[i].jurusan << endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment