0

I'm having an issue with CS50's check50 utility. My week 3 Plurality code is working, but when I submit it to be checked I get these results:

Results for cs50/problems/2020/x/plurality generated by check50 v3.0.10
:) plurality.c exists
:( plurality compiles
    code failed to compile
:| vote returns true when given name of first candidate
    can't check until a frown turns upside down
:| vote returns true when given name of middle candidate
    can't check until a frown turns upside down
:| vote returns true when given name of last candidate
    can't check until a frown turns upside down
:| vote returns false when given name of invalid candidate
    can't check until a frown turns upside down
:| vote produces correct counts when all votes are zero

etc...

Except, the code does compile. I have tested it with multiple compilers on my own machine (GCC, clang) with multiple -pedantic flag levels; I have tested it in CS50's IDE by specifying a compiler directly (also GCC) and this produces a working executable; and of course the make plurality command, which also produces working output. The executables also work, obviously, but this shouldn't matter; the results complain that the code doesn't compile, which of course it obviously does (on 2 different plaforms, for multiple compilers).

What is going on here? If there is something obvious I've missed, then why is my code still compiling and running fine outside of check50?

Here are my #includes and headers:

#include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <ctype.h>

#define MAX_NAME_LENGTH 128
#define CHR_VOTE_COUNT 5    // 1 character, max. votes of 9., check buffer, plus null & newline character
#define MAX_VOTES 9

I can paste in other code if necessary, but it isn't particularly interesting.

Thanks for any help!

4
  • 2
    Does this answer your question? check50 claiming pairs are sorted incorrectly Commented Mar 12, 2020 at 16:51
  • The #defines violate this imperative from the spec "You should not modify anything else in plurality.c other than the implementations of the vote and print_winner functions (and the inclusion of additional header files, if you’d like)." Commented Mar 12, 2020 at 16:53
  • Ah. I don't write the code in their IDE, and I don't even use their template tideman.c file, I just write everything from scratch. I was more interested in getting the code performing properly than checking through all the catches. Will look out in the future.
    – Rowan
    Commented Mar 12, 2020 at 17:17
  • Keep in mind that a lot of the code that's distributed is written in a certain way to accommodate check50. Changing anything that should not be changed caused problems for a host of different reasons.
    – Cliff B
    Commented Mar 13, 2020 at 6:07

1 Answer 1

1

The plurality problem seems to only allow you to change the TODO parts in the bool and void function. check if you didn't edit any parts of the distribution code given, and if removing the extra #define you added will pass through check50.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .