check50

cs50/problems/2025/x/plurality


:) plurality.c exists

Log
checking that plurality.c exists...

:( plurality compiles

Cause
code failed to compile

Log
running clang plurality.c -o plurality -std=c11 -ggdb -lm -lcs50...
running clang plurality_test.c -o plurality_test -std=c11 -ggdb -lm -lcs50...
plurality_test.c:76:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
76 | }
| ^
plurality_test.c:95:13: error: use of undeclared identifier 'candidate_count'
95 | candidate_count = 3;
| ^
plurality_test.c:96:13: error: unknown type name 'candidates'; did you mean 'candidate'?
96 | candidates[0].name = "Alice";
| ^~~~~~~~~~
| candidate
plurality_test.c:9:1: note: 'candidate' declared here
9 | candidate;
| ^
plurality_test.c:96:26: error: expected identifier or '('
96 | candidates[0].name = "Alice";
| ^
plurality_test.c:97:13: error: unknown type name 'candidates'; did you mean 'candidate'?
97 | candidates[0].votes = 0;
| ^~~~~~~~~~
| candidate
plurality_test.c:9:1: note: 'candidate' declared here
9 | candidate;
| ^
plurality_test.c:97:26: error: expected identifier or '('
97 | candidates[0].votes = 0;
| ^
plurality_test.c:115:26: error: call to undeclared function 'vote'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
115 | printf("%s", vote(alice) ? "true" : "false");
| ^
plurality_test.c:132:32: error: use of undeclared identifier 'candidates'
132 | printf("%i %i %i", candidates[0].votes, candidates[1].votes, candidates[2].votes);
| ^
plurality_test.c:132:53: error: use of undeclared identifier 'candidates'
132 | printf("%i %i %i", candidates[0].votes, candidates[1].votes, candidates[2].votes);
| ^
plurality_test.c:132:74: error: use of undeclared identifier 'candidates'
132 | printf("%i %i %i", candidates[0].votes, candidates[1].votes, candidates[2].votes);
| ^
plurality_test.c:136:13: error: unknown type name 'candidates'; did you mean 'candidate'?
136 | candidates[0].votes = 2;
| ^~~~~~~~~~
| candidate
plurality_test.c:9:1: note: 'candidate' declared here
9 | candidate;
| ^
plurality_test.c:136:26: error: expected identifier or '('
136 | candidates[0].votes = 2;
| ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.

:| vote returns true when given name of first candidate

Cause
can't check until a frown turns upside down

:| vote returns true when given name of middle candidate

Cause
can't check until a frown turns upside down

:| vote returns true when given name of last candidate

Cause
can't check until a frown turns upside down

:| vote returns false when given name of invalid candidate

Cause
can't check until a frown turns upside down

:| vote produces correct counts when all votes are zero

Cause
can't check until a frown turns upside down

:| vote produces correct counts after some have already voted

Cause
can't check until a frown turns upside down

:| vote leaves vote counts unchanged when voting for invalid candidate

Cause
can't check until a frown turns upside down

:| print_winner identifies Alice as winner of election

Cause
can't check until a frown turns upside down

:| print_winner identifies Bob as winner of election

Cause
can't check until a frown turns upside down

:| print_winner identifies Charlie as winner of election

Cause
can't check until a frown turns upside down

:| print_winner prints multiple winners in case of tie

Cause
can't check until a frown turns upside down

:| print_winner prints all names when all candidates are tied

Cause
can't check until a frown turns upside down