You are on page 1of 1

Ahmad Khodadan Azizi

02311940000023
#include <iostream>
#include <string>
using namespace std;

int contoh() {
int x[5], i;
for (i = 0; i <= 4; i++)
{

cout << "Masukkan nilai "<<i+1<<" : ";

cin >> x[i];


}
cout << endl;
for (i = 0; i <= 4; i++)
{
cout << "Nilai ke-" << i + 1 << " = " << x[i] << endl;
}
cout << endl;
return 0;
}

struct siswa {
int no_induk;
string nama;
float nilai;
};

int main() {
siswa Objek;
cout << "masukkan NRP : ";
cin>>Objek.no_induk;
cout << "masukkan nama : ";
cin>>Objek.nama;
cout << " " << endl;
cout << "Input Struct" << endl;
cout << Objek.nama << " dengan NRP " << Objek.no_induk << endl;
cout << "=====================" << endl;
cout << "contoh program array" << endl;
cout << "=====================" << endl;
contoh();
return 0;
}

====================================================================================
Output:

You might also like