Questions tagged [pset3plurality]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

For CS50 plurality, check50 says that my code doesn't print the winner of the function. But it does?

#include <cs50.h> #include <stdio.h> #include <string.h> // Max number of candidates #define MAX 9 // Candidates have name and vote count typedef struct { string name; int ...
Harrison 's user avatar
0 votes
1 answer
33 views

pset3: Plurality - check50 errors despite code working

My code appears to work, successfully printing the candidate/candidates with the most votes. However, I fail all of check50’s ‘print_winner’ function tests. I have looked around for a while online, ...
TheWanderingAmateur's user avatar
0 votes
2 answers
72 views

Errors in check50 with plurality.c?

I've finished my plurality code (I even managed to make a version that detects lowercase) but here I paste my simplest version of it (plurality.c). The issue is that I get 10 out of 14 correct in ...
Mariano MF's user avatar
0 votes
1 answer
76 views

CS50 Plurality: can't compare candidate[0].name and name

I have been doing the plurality problem, from problem set 3. But I have stumbled upon a problem that I can't seem to solve in any way. In the function vote, when I use the first candidate as an its ...
ThatLinuxGuy's user avatar
0 votes
1 answer
81 views

Pset 3 plurality compiling error

so I'm doing the plurality right now, and like how I said in the title there is an error about compiling my code I guess It should be something about returning but I still don't have any idea what to ...
Ibrahim's user avatar
0 votes
1 answer
126 views

Pset3 Plurality - not able to get the right output

Here is my code for the print_winner() function. I am pretty sure the problem is here because I have checked other parts of the code which seem alright. void print_winner(void) { for (int i = 0; i ...
Soumik's user avatar
  • 15
0 votes
1 answer
53 views

Pset 3 Plurality "use of undeclared identifier"

I'm not sure I understand why here: // Update vote totals given a new vote bool vote(string name) { for (int j = 0; j < candidate_count; j++) { if (strcmp(name, candidates[j].name) =...
jiayou's user avatar
  • 17
0 votes
1 answer
29 views

Pset3, Plurality - seems to be skipping the first the return true for each first vote cast for a candidate

This is the first question I have asked but I can not seem to find the answer anywhere. let say I put in 2 candidates alice and bob with 5 for the number of votes. Every time I first write a vote say ...
Eric Morrison's user avatar
-1 votes
2 answers
67 views

plurality pset3

I have no idea why this does not work. It works a little bit but not fully? the error will occur when I attempt to vote for someone that is not in candidates.name. edit: i added !=0 on line 71. In ...
gabrielwu123's user avatar
0 votes
1 answer
78 views

Plurality CS50 Week3 pset3

// Print the winner (or winners) of the election void print_winner(void) { int max =0; for(int i=0; i<candidate_count; i++) { if(candidates[i].votes>candidates[i+1].votes) ...
user01's user avatar
  • 7
0 votes
0 answers
266 views

Help on Plurality Pset3

I'm trying to solve assignment "Plurality" of Problem set 3. However, check50 didn't prove to be quite useful for me this time. I'm having only one error message saying "print_winner&...
Zoltán Uhlár's user avatar
0 votes
1 answer
56 views

Plurality print_winner function gives one error

This is my print_winner function void print_winner(void) { int winner_vote; for (int i = 0; i < candidate_count; i++) { for(int j = i + 1; j < candidate_count; j++) {...
VooDooDarkMagic's user avatar
0 votes
1 answer
1k views

cs50 plurality non-void function does not return a value in all control paths error

I'm currently trying to do cs50 pset3 plurality problem and I have unfortunately ran into this error which I do not know how to overcome. The error is "non-void function does not return a value ...
Amos Ting's user avatar
0 votes
1 answer
34 views

Check50 doesnt approve but code seems to work fine

PSET3 Plurality: Although the problem itself isn't tough to solve but Check50 simply doesn't like the way I wrote it. I've been trying to pass the tests since an hour or more but I can't figure out ...
Samarth's user avatar
-1 votes
1 answer
45 views

pset3 - plurality - failing check50 'print multiple winners' - but my own tests say it works, not sure what I'm missing

I'm not sure why my program is failing check50, when I run my own tests it does seem to print multiple winners, but check50 says it doesn't print multiple winners [removed solution code]
gudge_on's user avatar
0 votes
1 answer
28 views

How do you make a rule for the target?

Hi I've been struggling with this course for a while now and I keep getting the same error message for Plurality pset3 that there is no target to make plurality. I renamed the file plurality.c and ...
Tahera Rouf's user avatar
0 votes
2 answers
115 views

check50 for plurality

Every example I try myself works perfectly fine but once I check50 it, I get error messages for not printing one,two, or all three winners. I saw some people having format issues with spaces, but I ...
maxilau's user avatar
1 vote
1 answer
195 views

pset3 Plurality

Having an issure writing my plurality code pset. i wanted to have my programme promt a user when they have made an invalid vote entry. and it works ok but ive found a bug while testing it: code: #...
Pot Noodle's user avatar
0 votes
1 answer
117 views

pset 3 plurality

To figure out the winner, I am trying to do a bubble sort and then print the last name (or names if the last two are tied). For some reason, after it goes through the first run-through of the bubble ...
Matthew's user avatar
  • 15
0 votes
2 answers
405 views

CS50 pset3 plurality program gives error for print_winner function (did not print both winners of election)

I have finished the plurality program for pset3 of cs50, but upon running check50 on my code, I receive the following error directed towards the print_winner function: :) plurality.c exists :) ...
qwert9988's user avatar
0 votes
1 answer
273 views

Having problems with plurality for cs50

I am trying to run the program for plurality for cs50, and the program compiles I put my candidates in and number of voters and vote, but instead of printing the winner it gives me a segmentation ...
Keith's user avatar
  • 15
0 votes
1 answer
52 views

My Plurality.c works when I test it with all of their usage examples but when I run check or submit it says it doesn't print

I'm a beginner and CS50 is the first coding experience I have. Like the title says, my code works when I test it but the CS50 won't accept it so I'm not sure what's wrong. Thanks for any help! ps. ...
Paoliz Rodriguez's user avatar
0 votes
3 answers
1k views

pset 3 plurality code help

My code prints all names in the case of a two way/threeway tie, but for some reason I still get an error message in check50 that it does not. The only thing I could think of was maybe it had to do ...
ayeeitsalpha's user avatar
0 votes
0 answers
173 views

Pset 3 Plurality - Error: linker command failed with exit code 1 (use -v to see invocation)

I have come across an unusual situation and I was not able to find a solution on this elsewhere. So for some reason, I was having issue compiling my plurality assignment and it kept on giving me the ...
Bilal Junaidy's user avatar
0 votes
1 answer
483 views

Plurality vote strange errors

My code works consistently, but I get these two errors which I check it. I would like to know how to replicate these errors on my own so that I can figure out how to fix them. #include <stdio.h>...
zs4321's user avatar
  • 1
0 votes
1 answer
281 views

Plurality segmentation fault

I am getting a segmentation fault despite knowing that the size of the candidates[] array is the same as the value stored in the variable candidate_count and I am iterating through the array from 0 to ...
Aathish Bhagwandhin's user avatar
0 votes
1 answer
76 views

why am I getting a segmentation fault?

so this is week three and I know we will learn about memory location next week. However I got a segmentation fault and don't know how to fix it or why it happened. // Update vote totals given a new ...
Chris's user avatar
  • 428
0 votes
1 answer
198 views

why does it not return a value for bool?

So my code does not compile because it does not return a value. I don't know how to make it work and return true and false as it is in the if statement // Update vote totals given a new vote bool ...
Chris's user avatar
  • 428