-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnesting struct latihan.cpp
More file actions
41 lines (33 loc) · 895 Bytes
/
nesting struct latihan.cpp
File metadata and controls
41 lines (33 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <string>
struct pemain{
std::string nama;
int tahun_lahir;
};
struct klub{
std::string nama_klub;
std::string nama_stadium;
//struc pemain
pemain player1;
pemain player2;
};
int main(){
pemain uplayer1,uplayer2;
klub klub1;
uplayer1.nama = "Ronaldo";
uplayer1.tahun_lahir = 2000;
uplayer1.nama = "Batista";
uplayer1.tahun_lahir = 2003;
klub1.player1 = uplayer1;
klub1.player2 = uplayer2;
//struct klub
klub1.nama_klub = "Arsenal";
klub1.nama_stadium = "Emirates Stadium";
std::cout << "-----------------------------------------" << std::endl;
std::cout << klub1.nama_klub << std::endl;
std::cout << klub1.nama_stadium << std::endl;
std::cout << klub1.player1.nama << std::endl;
std::cout << klub1.player1.tahun_lahir << std::endl;
std::cin.get();
return 0;
}