summaryrefslogtreecommitdiff
path: root/wk3/sect
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-02-18 06:56:49 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-02-18 06:56:49 +0000
commitdb5d86398298219531a19cd21549119716e8a898 (patch)
tree0876b2303e95bb45337b80bf1a01d3a049b9116c /wk3/sect
parenta73bb4e170ac9ed4d76bdf3a0cef7c6c74eca8e1 (diff)
Sat, Feb 17, 2024, 10:56 PM -08:00
Diffstat (limited to 'wk3/sect')
-rw-r--r--wk3/sect/candidate.c12
1 files changed, 9 insertions, 3 deletions
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;
}
/*