Questions tagged [runoff]
The runoff tag has no usage guidance.
89
questions
1
vote
4
answers
203
views
check50 errors - runoff
I've been trying to resolve these myself for too long - I'm officially stuck
These are the check50 errors I get:
:( tabulate counts votes when multiple candidates are eliminated
:( find_min ignores ...
0
votes
1
answer
173
views
pset3 runoff print_winner check50 error
So I have seen this issue mentioned here before and the others have suggested that printing a newline after the name is the solution. However, my code does print a newline and in my tests, I'm getting ...
0
votes
1
answer
29
views
what does different return value signifies in this problem of runoff?
#include <cs50.h>
#include <stdio.h>
// Max voters and candidates
#define MAX_VOTERS 100
#define MAX_CANDIDATES 9
// preferences[i][j] is jth preference for voter i
int preferences[...
0
votes
1
answer
70
views
Back again with runoff problems, tabulate() passes no check50 tests
(I can't get formatting to work properly here so it might look a bit weird)
void tabulate(void)
{
int j = 0;
for(int i = 0; i < candidate_count; i++)
{
for( ; j < voter_count;)
{
...
0
votes
1
answer
79
views
cs50 pset3 runoff tabulate - why you say candidates[i].votes = 0 ; here?
why use that ??
for (int i = 0; i < candidate_count; i++)
{
candidates[i].votes = 0;
}
}
return 0;
0
votes
1
answer
96
views
My runoff problem doesn't pass check50
when I run check50 this is the message I get and I don't know what to fix
:( tabulate counts votes when all candidates remain in election
tabulate function did not produce correct vote totals
:( ...
0
votes
1
answer
539
views
PSET3 Runoff - Tabulate (multiple candidates)
I am stuck at this error for hours, I would appreciate your help. There is two errors:
:) tabulate counts votes when all candidates remain in election
:) tabulate counts votes when one candidate is ...
1
vote
1
answer
260
views
pset3 runoff help -> 3 :( showing on check50
I'm getting the following fails when I check pset3 runoff (all the rest are coming up as correct)
:( tabulate counts votes when multiple candidates are eliminated
tabulate function did not produce ...
0
votes
1
answer
79
views
Stuck on 'runoff'in pset3
I have been working on the runoff assignment from week 3. I am having issues with two of my functions: tabulate() and print_winner(). I have implemented them in the following ways:
Here my ...
0
votes
1
answer
40
views
Pset3 add value to preferences array
my code
for (int i = 0; i < candidate_count; i++)
{
if (strcmp(candidates[i].name, name) == 0)
{
preferences[voter][rank] = i;
return true;
}
}
I'm able to printout ...
0
votes
1
answer
108
views
Help with Pset3 Runoff check50
After a while i got runoff working but when i ran it through check50 there seem to be some errors but i just can't figure out what they are
:) runoff.c exists
:) runoff compiles
:) vote returns true ...
0
votes
1
answer
452
views
Why do I keep getting the error "expression result unused" in PSET 3 runoff?
I keep getting the error "expression result unused" on the line with preferences[i][j]; . I've tried reinitializing the j and the i variable in the loop in different ways but nothing I've ...
0
votes
1
answer
185
views
*** No rule to make target 'runoff'. Stop. Even though I'm in the correct directory
I keep getting the No rule to make target error on the runoff problem even when I'm in the correct directory as you can see in the picture attached.
Note: I have just completed the vote function for ...
0
votes
0
answers
15
views
Hi guy!! Could you please help me with CS50 week 3 runoff on tabulate function?
here is my code
void tabulate(void)
{
// TODO
for (int i = 0; i < voter_count; i++)
{
for (int j = 0; j < candidate_count; j++)
{
for (int k = 0; k < candidate_count; k++)
...
0
votes
1
answer
101
views
CS50 Runoff – Cannot get program to execute, am I stuck in an infinite loop somewhere?
I'm trying to execute runoff but after I enter the voters' ranks, the terminal window blinks back at me with nothing. I've scoured all over for similar problems but cannot figure out a solution.
I've ...
0
votes
1
answer
102
views
Pset3 runoff tabulation error
[![enter image description here][1]][1]
I keep getting a tabulation error with check50 that I cannot replicate
11 voters, 4 candidates, 3 or 4 rounds of voting works fine with I run it, and debug50 ...
0
votes
1
answer
115
views
Having trouble with is_tie in runoff. How do I use a count in an if statement as a variable in another if statement?
I need to be able to count "eliminated" from the number returning true from one if statement and use it in the if statement that follows it. How do I get the code to store the new "...
0
votes
1
answer
68
views
Is check50 cs50/problems/2022/x/runoff correct?
I write vode(),
"check50 cs50/problems/2022/x/runoff" reports the vode() is wrong.
after commnt out 2 lines (marked "// TODO: Need or Not" in th code),
"check50 ..." ...
0
votes
2
answers
180
views
Pset 3 runoff Randomly Increasing Votecount
I'm close to solving pset 3 runoff but I've run into this interesting problem in my tabulate function.
Whenever I run the program with the debugger, my vote counts keep increasing by very large ...
0
votes
0
answers
18
views
I don't know why my code doesn't work correctly, can you help me? PSet03 - Runoff
I,ve been completed all the functions that i'd need to complete in the Pset Runoff but I don't know why when I do the check50 it gave some errors and My code doesn't print out the winner as well. Here ...
0
votes
1
answer
130
views
Vote Function in Runoff
Here's my code
bool vote(int voter, int rank, string name)
{
int j = 0;
for (int i = 0; i < voter_count; i++)
if (strcmp(name, candidates[i].name) == 0)
{
preferences[i][...
0
votes
1
answer
241
views
PSET3 Runoff -- cannot seem to resolve "is_tie detects tie after some candidates have been eliminated"
I have been looking up and down through my code to no avail. Check50 shows that all tests are successful except for "is_tie detects tie after some candidates have been eliminated". I haven't the ...
0
votes
2
answers
111
views
Help with pset3 runoff
is this correct for vote function..struggled to figure out how to access candidate index so not sure if this is correct..any help/advice would be greatly appreciated
bool vote(int voter, int rank, ...
0
votes
0
answers
17
views
Runoff Problem Winner Fail to check
void tabulate(void)
{
// TODO
int n = voter_count;
int c = candidate_count;
// First votes
for (int i = 0; i < n; i++)
for (int j = 0; j < c; j++)
{
...
0
votes
1
answer
356
views
CS50 Runoff Tabulate
So I have been working on the tabulate function and Check50 says that the function is correct and it does properly work when no candidate is eliminated and when one is eliminated, but not when ...
0
votes
1
answer
68
views
Problem Set 3 (Runoff) print_winner function doesn't print and quits
I am working on problem set 3 runoff and I am having trouble with getting my print_winner function to work correctly. When I run the program it basically does nothing and quits the program. It gets ...
0
votes
1
answer
330
views
pset3 (runoff) check50 is giving an error for print_winner
I can't find what's wrong with my code but check50 keeps telling me
:( print_winner prints name when someone has a majority
print_winner did not print winner of election
:( print_winner returns ...
0
votes
1
answer
33
views
Pset3 runoff: why does the is_tie function work one way but the inverse does not?
I completed the problem set runoff and finally got it after initially way overthinking.
I often find myself just needing to invert/revert logic on these problem sets which is frustrating because I ...
0
votes
2
answers
398
views
Runoff Help: Tabulate Handles Multiple Rounds of Preferences
I cannot figure out why I am getting rejected on check50 for ":( tabulate handles multiple rounds of preferences - tabulate function did not produce correct vote totals". I get green ...
0
votes
0
answers
50
views
Problems with Tabulate in Pset3 Runoff Question
I am having trouble wrapping my head around the tabulate function for the runoff problem in pset3. I know I need to add one to the candidate[i].votes array given that the preferences[][] for a voter ...
0
votes
1
answer
65
views
whats wrong with my printwinner punction
i tested this function and it works but check50 seems to have a problem.
:( print_winner returns true when someone has a majority
print_winner did not print winner and then return true
:( ...
0
votes
0
answers
9
views
Terminal not resetting
I am working on "Runoff" and I got the function part down in vote, but I am having trouble figuring out if I'm missing something. After getting the ranked votes, terminal does not move on, ...
0
votes
0
answers
51
views
Help with print_winner in Pset3 Runoff
I'm almost finished with Runoff and have solved all of the other functions except for print_winner. I can't help but think I'm missing something simple here. Can anyone see where I am going wrong?
// ...
0
votes
2
answers
156
views
Pset3 Runoff - Printing All Candidates
Could use some help with Runoff. If I do a simple clear winner (all voters vote for the same person as first choice) it prints out the winner just fine. But if I do the test input that the problem ...
0
votes
0
answers
37
views
Problem Set 3: Runoff - Tabulate Errors
I get the following errors on check50:
:( tabulate counts votes when multiple candidates are eliminated
and
:( tabulate handles multiple rounds of preferences.
I have run debug50 but it gets me ...
1
vote
2
answers
93
views
(!vote) in runoff [pset3]
I am having real difficulty understanding how calling the vote function for valid votes in runoff is supposed to work.
The relevant part of the distribution code is as follows:
// Record vote, unless ...
0
votes
2
answers
207
views
PSET3 Runoff Vote Function
I'm having trouble understanding how to write this vote function. I understand what I wrote is incorrect because I am assigning a struct to an array of ints but I can't understand how I'm supposed to ...
0
votes
1
answer
191
views
PSET 3 runoff is_tie function
New to this platform, forgive me if there are some norm or etiquette I may be missing. Please feel free to provide feedback on anything that is incorrect.
This is for the is-tie function alone. I ...
0
votes
1
answer
71
views
pset3 runoff tabulate function not knowing where to start
Is it required to eliminate candidates within the tabulate function? How should we recognize when a candidate is eliminated and how do we go about increasing vote count catering for eliminated ...
0
votes
2
answers
46
views
Pset3 Runoff CS50x
I have been trying to debugg the program for a while but am not able to figure out what the error in line 9 is as this was the code provided by the courses and I didn't make any changes.
Any help ...
0
votes
1
answer
423
views
pset3 runoff: find_min function help
please help.
Errors:
:( find_min returns minimum when all candidates are tied
find_min did not identify correct minimum
:( find_min ignores eliminated candidates
find_min did not identify correct ...
2
votes
4
answers
11k
views
cs50 pset3 runoff tabulate
i have completed the problem set however when i check,
this is the only problem.
:) tabulate counts votes when all candidates remain in election
:) tabulate counts votes when one candidate is ...
0
votes
1
answer
35
views
Vote indexing problem
my code works well in indexing all votes in the preferences except for the first one, I tried debugging and it worked well for all indexes including the first one..!
0
votes
1
answer
231
views
Pset3 - runoff - print_winner and find_min error
After I checked my code using check50 cs50/problems/2021/x/runoff, I received the following error messages for my bool print_winner(void) function and int find_min(void) function as follows
:( ...
0
votes
1
answer
467
views
PSET3 Runoff - tabulate() function for multiple eliminated candidates
I'm working on the tabulate() function, and to an extent the is_tie() function
The tabulate() function passes all the tests of check50 but the last one:
:( tabulate counts votes when multiple ...
0
votes
2
answers
232
views
what is the significance of break; in tabulate function?
I know break statements are pretty basic, but it's got me here:
This is my function:
for (int i = 0; i < voter_count; i++)
{
for (int j = 0; j < candidate_count; j++)
{
if (...
2
votes
2
answers
2k
views
pset3 (runoff) keep getting print_winner error when using check50
I keep getting these errors when running check50 on my runoff program:
print_winner prints name when someone has a majority
print_winner did not print winner of election
print_winner returns ...
0
votes
1
answer
232
views
CS50 - pset3 - Runoff | Check50 failing print_winner on majority but works correctly for any manual test I can think of
I'm having trouble with getting Runoff to complete Check50. All checks are passing except the two below for the print_winner function
:( print_winner prints name when someone has a majority
Cause
...
0
votes
1
answer
137
views
why am i getting an " use of undeclared identifier 'j' or 'i' " on the vote and tabulate functions?
shouldn't the compiler consider the 'i' and the 'j' from the for loop in the 'main' function to be the voter and rank ints passed to the functions
#include <cs50.h>
#include <stdio.h&...
0
votes
1
answer
151
views
Runoff: Issue with check50 on find_min function
I've tried two different variations of my implementation of the find_min functions and both times two of the requirements on check50 are achieved and only one shows an error.
Sucesses:
:) ...