I am really new to programing.
It took me a lot of efforts to complete my pset3 problem “plurality”. It is compiling and giving expected results in CS50 sandbox. But when I use “check50 cs50/problems/2020/x/plurality” to check my programe it gives me following errors. Please help.
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:109:13: error: use of undeclared identifier ‘candidate_count’
candidate_count = 3;
plurality_test.c:123:26: warning: implicit declaration of function ‘vote’ is
invalid in C99 [-Wimplicit-function-declaration]
printf("%s", vote(“Alice”) ? “true” : “false”);
plurality_test.c:163:13: warning: implicit declaration of function
‘print_winner’ is invalid in C99 [-Wimplicit-function-declaration]
2 warnings and 1 error generated.
I do understand the errors but here are few points which aren’t clear to me.
I didn’t even use the term “candidate_count” in my code, why am I getting error related to this.
Also I didn’t write any function called “print_winner”. I simply printed results within main function by other means. Why am I getting errors related to this?
Again I haven’t written any function called vote. I gave it the name votes. Why there are errors related to functions or terms which I didn’t even use?
My code is working fine in CS50 sandbox and giving proper results.