This repository has been archived by the owner on Jan 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEstructuraAnidadaConTablaDeEstructura
127 lines (107 loc) · 3.29 KB
/
EstructuraAnidadaConTablaDeEstructura
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include <stdio.h>
#define DIM 256
#define SIZE 3
#define SUMMONERS 2
typedef struct {
char champion[DIM];
int data[SIZE];
} Game;
typedef struct{
char name[DIM];
Game game[SIZE];
} Summoner;
int main(){
Summoner summoner[SUMMONERS];
int kills = 0, deaths = 0, assists = 0;
double kda = 0;
//P1
printf("Player 1\n");
printf("Name: ");
gets(summoner[0].name);
printf("First match: \n");
printf("Champion: ");
gets(summoner[0].game[0].champion);
printf("Kills: ");
scanf("%d", &summoner[0].game[0].data[0]);
kills+= summoner[0].game[0].data[0];
printf("Deaths: ");
scanf("%d", &summoner[0].game[0].data[2]);
deaths+= summoner[0].game[0].data[2];
printf("Assists: ");
scanf("%d", &summoner[0].game[0].data[1]);
assists+=summoner[0].game[0].data[1];
getchar();
printf("Second match: \n");
printf("Champion: ");
gets(summoner[0].game[1].champion);
printf("Kills: ");
scanf("%d", &summoner[0].game[1].data[0]);
kills+=summoner[0].game[1].data[0];
printf("Deaths: ");
scanf("%d", &summoner[0].game[1].data[2]);
deaths+=summoner[0].game[1].data[2];
printf("Assists: ");
scanf("%d", &summoner[0].game[1].data[1]);
assists+=summoner[0].game[1].data[1];
getchar();
printf("Third match: \n");
printf("Champion: ");
gets(summoner[0].game[2].champion);
printf("Kills: ");
scanf("%d", &summoner[0].game[2].data[0]);
kills+=summoner[0].game[2].data[0];
printf("Deaths: ");
scanf("%d", &summoner[0].game[2].data[2]);
deaths+=summoner[0].game[2].data[2];
printf("Assists: ");
scanf("%d", &summoner[0].game[2].data[1]);
assists+=summoner[0].game[2].data[1];
kda = (double)(kills+assists)/deaths;
printf("Your KDA of the last 3 games has been: %.2lf\n", kda);
//P2
printf("Player 2\n");
printf("Name: ");
getchar();
gets(summoner[1].name);
printf("First match: \n");
printf("Champion: ");
gets(summoner[1].game[0].champion);
printf("Kills: ");
scanf("%d", &summoner[1].game[0].data[0]);
kills = summoner[1].game[0].data[0];
printf("Deaths: ");
scanf("%d", &summoner[1].game[0].data[2]);
deaths = summoner[1].game[0].data[2];
printf("Assists: ");
scanf("%d", &summoner[1].game[0].data[1]);
assists = summoner[1].game[0].data[1];
getchar();
printf("Second match: \n");
printf("Champion: ");
gets(summoner[1].game[1].champion);
printf("Kills: ");
scanf("%d", &summoner[1].game[1].data[0]);
kills+=summoner[1].game[1].data[0];
printf("Deaths: ");
scanf("%d", &summoner[1].game[1].data[2]);
deaths+=summoner[1].game[1].data[2];
printf("Assists: ");
scanf("%d", &summoner[1].game[1].data[1]);
assists+=summoner[1].game[1].data[1];
getchar();
printf("Third match: \n");
printf("Champion: ");
gets(summoner[1].game[2].champion);
printf("Kills: ");
scanf("%d", &summoner[1].game[2].data[0]);
kills+=summoner[1].game[2].data[0];
printf("Deaths: ");
scanf("%d", &summoner[1].game[2].data[2]);
deaths+=summoner[1].game[2].data[2];
printf("Assists: ");
scanf("%d", &summoner[1].game[2].data[1]);
assists+=summoner[1].game[2].data[1];
kda = (double)(kills+assists)/deaths;
printf("Your KDA of the last 3 games has been: %.2lf", kda);
return 0;
}