From db5d86398298219531a19cd21549119716e8a898 Mon Sep 17 00:00:00 2001 From: Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> Date: Sun, 18 Feb 2024 06:56:49 +0000 Subject: Sat, Feb 17, 2024, 10:56 PM -08:00 --- wk3/sect/candidate.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'wk3/sect/candidate.c') diff --git a/wk3/sect/candidate.c b/wk3/sect/candidate.c index 0f121a9..bb849df 100644 --- a/wk3/sect/candidate.c +++ b/wk3/sect/candidate.c @@ -9,14 +9,20 @@ typedef struct { int votes; } candidate; +candidate get_candidate(string prompt); + int main(void) { candidate president = get_candidate("Enter a candidate: "); - president.name = "Alyssa"; - president.votes = 10; + printf("%s\n", president.name); + printf("%i\n", president.votes); } candidate get_candidate(string prompt) { - + printf("%s\n", prompt); + candidate c; + c.name = get_string("Enter a name: "); + c.votes = get_int("Enter a numbe of votes: "); + return c; } /* -- cgit v1.2.3