-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelection.x
50 lines (37 loc) · 889 Bytes
/
election.x
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
struct voter {
char id[9];
char name[32];
char gender;
int vote;
};
struct candidate {
char name[32];
int votes;
bool valid;
};
struct candidate_stats {
double total_vote_percent;
double male_vote_percent;
double female_vote_percent;
};
struct stats {
double total_vote_percent;
double male_vote_percent;
double female_vote_percent;
candidate_stats candidate<>;
};
typedef voter *voter_ptr;
typedef candidate candidate_list<>;
program ELECTION {
version ELECTIONVERS {
string register_voter(string, char) = 1;
bool verify_voter(string) = 2;
bool cast_vote(string, string) = 3;
candidate_list tally_results(void) = 4;
string announce_winner(void) = 5;
bool add_candidate(string) = 6;
bool remove_candidate(string) = 7;
bool invalidate_candidate(string) = 8;
stats calc_statistics() = 9;
} = 1;
} = 0x20000001;