Questions tagged [runoff]

The tag has no usage guidance.

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

pset3, runoff, tabulate counts twice under certain circumstances

I've been working on runoff for various days now. a. Function Vote is complete b. Function Tabulate, I think is complete and well written c. Function print_winner, I think is complete and well written ...
user avatar
0 votes
0 answers
7 views

Segmentation Fault Is Ruining My Friday

I have been working on PS3 Runoff for quite sometime, and after troubleshooting gazillion errors, segmentation fault came up to rain on my parade. Here's my code as I have no clue what's causing it. ...
user avatar
0 votes
2 answers
56 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 ...
user avatar
0 votes
1 answer
32 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 ...
user avatar
  • 23
0 votes
1 answer
21 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 ...
user avatar
0 votes
1 answer
52 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 ...
user avatar
0 votes
1 answer
37 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 ...
user avatar
0 votes
2 answers
30 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 ...
user avatar
  • 7
0 votes
1 answer
48 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 ...
user avatar
0 votes
1 answer
29 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 ...
user avatar
0 votes
1 answer
57 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 ...
user avatar
0 votes
0 answers
16 views

Tabulate fails with candidate elimination

I 've tried many things and they didn't solve the problem. Thanks in advance.
user avatar
0 votes
1 answer
29 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..!
user avatar
0 votes
0 answers
10 views

Preferences error

I can't fully understand this code syntax or how it will look like if we are going to print it for example.
user avatar
0 votes
1 answer
52 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 "...
user avatar
  • 14
0 votes
1 answer
135 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 :( ...
user avatar
0 votes
1 answer
46 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 ...
user avatar
0 votes
1 answer
133 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 ...
user avatar
0 votes
1 answer
51 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&...
user avatar
0 votes
1 answer
78 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: :) ...
user avatar
0 votes
0 answers
103 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 ...
user avatar
0 votes
1 answer
471 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 ...
user avatar
0 votes
1 answer
88 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 ...
user avatar
0 votes
2 answers
197 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 ...
user avatar
  • 1
0 votes
1 answer
999 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 { ...
user avatar
0 votes
1 answer
254 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 ...
user avatar
  • 1
0 votes
1 answer
25 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) { ...
user avatar
0 votes
1 answer
37 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 ...
user avatar
0 votes
1 answer
63 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) { ...
user avatar
0 votes
1 answer
84 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 < ...
user avatar
0 votes
1 answer
106 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][...
user avatar
0 votes
0 answers
76 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 ...
user avatar
0 votes
2 answers
60 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 ...
user avatar
  • 1
0 votes
1 answer
286 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 ...
user avatar
0 votes
1 answer
316 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 ...
user avatar
0 votes
1 answer
83 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 :( ...
user avatar
0 votes
1 answer
120 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 ...
user avatar
0 votes
1 answer
42 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 ...
user avatar
  • 13
1 vote
1 answer
226 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 ...
user avatar
0 votes
1 answer
99 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 ...
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++) { ...
user avatar
1 vote
3 answers
96 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) { ...
user avatar
1 vote
1 answer
173 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; ...
user avatar
  • 17
0 votes
1 answer
62 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 ...
user avatar
0 votes
1 answer
80 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 ...
user avatar
0 votes
1 answer
193 views

Trouble with find_min

I'm trying to implement a bubble sort in the find_min function in pset3 runoff. But It looks like it is not returning the correct min. I think it is because candidates[0].votes may not be the lowest ...
user avatar
1 vote
5 answers
140 views

Trouble with tabulate and printwinner

I'm having a hard time with the runoff problem in pset3, especially with the tabulate function. Based on the instructions it looks like I need to update the preferences array but I'm not sure how. I'm ...
user avatar
2 votes
2 answers
97 views

Trouble with vote function

I can't get the vote function in Runoff to work properly. Can anyone help explain what I am doing wrong here? bool vote(int voter, int rank, string name) { for (int i = 0; i < voter_count; i++) ...
user avatar
0 votes
2 answers
182 views

Pset3 Runoff tabulation issues

I am so close to a successful runoff program, but I've been having issues with the tabulation section. I decided that this was a good place to implement a recursive function, but it is a new concept ...
user avatar
0 votes
1 answer
114 views

pset 3 runoff find_min - where is my logic failing ? - the check gives and error saying it doesn`t find the correct min

int find_min(void) { int min = voter_count; for (int i = 0; i < candidate_count; i++) { if (candidates[i].eliminated == false && candidates[i].votes < min) { min = ...
user avatar
  • 109