Questions tagged [pset3plurality]
The pset3plurality tag has no usage guidance.
24
questions
0
votes
1
answer
24
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 ...
0
votes
1
answer
15
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 ...
0
votes
1
answer
12
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) =...
0
votes
1
answer
20
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 ...
0
votes
2
answers
36
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 ...
0
votes
1
answer
52
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)
...
0
votes
0
answers
141
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&...
0
votes
1
answer
51
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++)
{...
0
votes
1
answer
764
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 ...
0
votes
1
answer
30
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 ...
-1
votes
1
answer
42
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]
0
votes
1
answer
17
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 ...
0
votes
2
answers
98
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 ...
1
vote
1
answer
141
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:
#...
0
votes
1
answer
99
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 ...
0
votes
2
answers
366
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
:) ...
0
votes
1
answer
217
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 ...
0
votes
1
answer
50
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. ...
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 ...
0
votes
0
answers
158
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 ...
0
votes
1
answer
420
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>...
0
votes
1
answer
267
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 ...
0
votes
1
answer
74
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 ...
0
votes
1
answer
178
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 ...