Questions tagged [runoff]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
11 views

runoff is_tie and print_winner

I'm having a hard time seeing where I went wrong with my two functions IS_TIE and PRINT_WINNER when I put my code through check50, for print_winner I get: "did not print winner of election" ...
faeyb's user avatar
  • 7
0 votes
1 answer
18 views

runoff bool is_tie

Feel really stuck in my is_tie function, check50 returns errors... :( is_tie returns true when election is tied is_tie did not return true :( is_tie returns false when election is not tied ...
Anna's user avatar
  • 7
0 votes
0 answers
16 views

How to make pset 3 runoff effect multiple eliminated candidates?

#include <cs50.h> #include <stdio.h> #include <string.h> // Max voters and candidates #define MAX_VOTERS 100 #define MAX_CANDIDATES 9 // preferences[i][j] is jth preference for ...
Harr's user avatar
  • 35
0 votes
0 answers
22 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++) ...
Ethanboom's user avatar
0 votes
0 answers
24 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 ...
AlvaroAndLukeTheCoder's user avatar
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++) { ...
기묘한아이's user avatar
0 votes
1 answer
45 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 ...
user avatar
0 votes
1 answer
80 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 ..." ...
katoy's user avatar
  • 101
0 votes
1 answer
82 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 :( ...
yosef's user avatar
  • 5
0 votes
1 answer
148 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 ...
Schmilp's user avatar
0 votes
0 answers
56 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? // ...
getsendy's user avatar
0 votes
2 answers
276 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 ...
Cristian's user avatar
0 votes
1 answer
287 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 ...
x code's user avatar
  • 23
0 votes
1 answer
83 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 ...
turbulenttangles's user avatar
0 votes
1 answer
667 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 ...
Guilherme H's user avatar
0 votes
1 answer
87 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 ...
mz1user's user avatar
0 votes
2 answers
52 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 ...
user01's user avatar
  • 7
0 votes
1 answer
519 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 ...
colliedawg's user avatar
0 votes
1 answer
41 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 ...
Drallas's user avatar
1 vote
2 answers
109 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 ...
danieljmoore3's user avatar
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..!
Mohamed Hassan's user avatar
0 votes
1 answer
121 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 "...
Lperino's user avatar
  • 14
0 votes
1 answer
267 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 :( ...
shaneinei's user avatar
0 votes
1 answer
83 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 ...
Dre Johnson's user avatar
0 votes
1 answer
256 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 ...
user3638166's user avatar
0 votes
1 answer
152 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&...
Moamen elafifi's user avatar
0 votes
1 answer
184 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: :) ...
ehsansth's user avatar
0 votes
0 answers
162 views

My tabulate function won't work for multiple eliminated candidates

I dont know what to do. My tabulate function won't work for multiple eliminated candidates and multiple rounds of preferences. The rest is fine, as check50 states: :) tabulate counts votes when all ...
c_dinosaur's user avatar
0 votes
1 answer
1k views

Pset3 Runoff is_tie

Having issues with Check 50 and the is_tie function: :( is_tie returns false when only some of the candidates are tied is_tie did not return false :( is_tie detects tie after some candidates have ...
Pot Noodle's user avatar
0 votes
1 answer
144 views

cs50 pset3 runoff tabulate function help

I have been stuck at the tabulate function for quite some time, I'm able to code all the other functions except for this tabulate functions. If possible do help me look to see what wrong with the ...
Amos Ting's user avatar
0 votes
2 answers
472 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 ...
Hunter's user avatar
  • 1
0 votes
1 answer
2k views

PSET 3 Runoff Error: variable length array declaration not allowed at file scope

I realize that this code is not well designed, however I will try to solve that once my code can compile. #include <stdio.h> #include <cs50.h> #include <string.h> typedef struct { ...
Ansar Sherkhanov's user avatar
0 votes
1 answer
489 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 ...
Moose's user avatar
  • 1
0 votes
1 answer
31 views

Tabulate not working when more than 1 candidate is eliminated

Here is my Tabulate Function - void tabulate(void) { int j = 0; for (int i = 0; i < voter_count; i++) { if (candidates[preferences[i][j]].eliminated == 1) { ...
FoundABetterName's user avatar
0 votes
1 answer
43 views

Please help me by reviewing my logic for Tabulate in Runoff Pset3

Let's say 3 candidates were their initially and A and B got 2 votes each while C got 1 hence C should be eliminated then in the next round we need to see the second preference votes right? As the ...
FoundABetterName's user avatar
0 votes
1 answer
68 views

pset 3 Runoff Where is my code wrong?

I have written the functions but I am not sure which one is wrong as I am not getting any output Here is my code: // Record preference if vote is valid bool vote(int voter, int rank, string name) { ...
FoundABetterName's user avatar
0 votes
1 answer
98 views

Tabulate in Runoff

Finally took a break for a few days to think about stuff and I am back at doing psets Now I am trying to fix the tabulate function, here's my code - void tabulate(void) { for (int i = 0; i < ...
FoundABetterName's user avatar
0 votes
1 answer
137 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][...
FoundABetterName's user avatar
0 votes
0 answers
94 views

Is my vote function correct in Runoff?

I have started runoff and just completed step 1 that is to write the vote function can someone tell me if it's correct? It seems to give the correct output but I don't think I used int rank in the ...
FoundABetterName's user avatar
0 votes
2 answers
75 views

Check50 all green but my own tests fail

I completed Runoff with 100% pass in check50 but when i do my own tests i get wrong winners. I checked everything to the best of my abilities but i just can't find the problem and it's driving me ...
VanG's user avatar
  • 1
0 votes
1 answer
386 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 ...
Javier Garza Suarez's user avatar
0 votes
1 answer
368 views

Pset3 Runoff Find Min not Coded Properly - Can't Find Error

The way I have coded it, I believe my min should be set correctly, but when I try to run it, the check50 says it's wrong. I tested it by printing my min at various points in the code, and it is not ...
user29490's user avatar
0 votes
1 answer
100 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 :( ...
Gloria Isedu's user avatar
0 votes
1 answer
128 views

Pset 3 runoff. Votes not updating, trying to understand the code sequencing

Ok so im stuck on the tabulate funtion in runoff for pset3. The issue im having is that when i call to "printf" the candidates vote counts the votes still come out as 0. So i dont think the ...
Pot Noodle's user avatar
0 votes
1 answer
46 views

PSET3 Runoff specification (year 2020): Multiple eliminated candidates featuring in the next-preferred candidates list

In the pset3 Runoff specification (year 2020), every voter effectively votes for their top-preferred candidate who has not already been eliminated. If the top-preferred candidate has already been ...
smitha's user avatar
  • 13
1 vote
1 answer
268 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 ...
Ian Samir Yep Manzano's user avatar
0 votes
1 answer
194 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 ...
math_guru's user avatar
1 vote
1 answer
43 views

pset 3 runoff help again

I still dont know what to put in for loop :( I still dont know what to put in the for loop for(int k = 0; k < voter_count; k++) { for (int j = 0; j < candidate_count; j++) { ...
iliketurtlz's user avatar
1 vote
2 answers
124 views

PSET3 Runoff Help Please

for(m = 0; m < voter_count; m++) { for(t = 1; t < 4; t++) { string name = get_string("Rank %i: ", t); } printf("\n"); } } bool vote(int voter, int rank, string name) { ...
iliketurtlz's user avatar
1 vote
1 answer
239 views

runoff tabulate error :( tabulate counts votes when multiple candidates are eliminated

void tabulate(void) { for (int i = 0; i < voter_count; i++) //as long as the number of total voters has not been met; this increases which voter we are on { int j = 0; ...
mushie2's user avatar
  • 17