#include #include typedef struct { string name; string party; float probability; } candidate; // Define SIZE as an integer that is global (accessible anywhere) and constant (cannot change). const int SIZE = 3; candidate get_candidate(string prompt); int main(void) { // Declare array of candidates with size equal to SIZE candidate candidates[SIZE]; // Add candidates to array using get_candidate and array value assignment for (int i = 0; i < SIZE; i++) { candidate new_candidate = get_candidate("Enter a candidate: "); candidates[i] = new_candidate; } // Print list of candidates by looping through array for (int i = 0; i < SIZE; i++) { printf("Candidate %i's name is: %s\n", i, candidates[i].name); printf("Candidate %i's party is: %s\n", i, candidates[i].party); printf("Candidate %i's probability is: %f\n", i, candidates[i].probability); } } candidate get_candidate(string prompt) { printf("%s\n", prompt); candidate new_candidate; new_candidate.name = get_string("What's the candidate's name? "); new_candidate.party = get_string("What's the candidate's party? "); new_candidate.probability = get_float("What's the candidate probability? "); return new_candidate; }