Skip to main content

Questions tagged [pset3]

The problem set for Week 3 asks students to write code for a classic puzzle game in the C programming language.

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

Tideman: Is my thinking correct for sort_pairs and lock_pairs?

I have just finished tideman and passed all checks on check50. However, I wanted to check if my thinking for my code is on the right track, or I got here just by luck. Firstly, for sort pairs, this is ...
Seanie's user avatar
  • 1
0 votes
2 answers
54 views

Inifinite loop for outdated problem

I am working on the "outdated" problem. I need to reformat the output given by the user in order to adehere to the ISO format. My code is as follows: months = ["January", "...
Elvino Michel's user avatar
1 vote
2 answers
30 views

Plurality - Test does not pass for the case of Bob

I'm trying to run check50 on plurality and I can pass all the tests except for the case of Bob where Bob's name is not printed. :( print_winner identifies Bob as winner of election expected "...
Craig D'Silva's user avatar
0 votes
1 answer
30 views

PSET3 Plurality - void print_winner(void) function

I am having a lot of difficulty with conceptualizing this function and applying this weeks lessons on algorithms. With the code below, what I have been trying to do is to mimic a selection sort, ...
Jeff's user avatar
  • 21
0 votes
2 answers
30 views

The code allways prompt to enter a new date when entering the date. How to correct my code in order to have the right answer?

import re months = [ "January", "February", "March", "April", "May", "June", "July", "August&...
Horace's user avatar
  • 1
0 votes
1 answer
58 views

Check50 says my answer is wrong. Why? Outdated.py pset3

Issue: Check50 output: My code isn't the cleanest or most optimized, but I'm pretty sure it works. def main(): day = 4000 months = [ "January", "February", &...
I'm Confused's user avatar
0 votes
1 answer
23 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
0 answers
14 views

i dont understand where i went wrong [duplicate]

void swap(int *xp, int *yp) { int temp; temp = *xp; *xp = *yp; *yp = temp; } // TODO: Sort cities by temperature in descending order void sort_cities(void) { int arr[NUM_CITIES]; int max_id; for(int i ...
Himanshu Sharma's user avatar
0 votes
1 answer
201 views

CS50 Meteorites Cleaning

Quick Question for yall, so I set .nullvalue to "NULL" before writing my table updates. Second question, how do I rearrange columns in my final meteorites table that was it passes the CS50 ...
adubzzzz's user avatar
0 votes
0 answers
31 views

Pset3 tideman error at lock_pairs

void lock_pairs(void) { int cycle = 0; int winner; for(int i = 0; i < pair_count;i++) { locked[pairs[i].winner][pairs[i].loser] = true; if (pairs[i].loser == pairs[i+...
Ahmed Yehya's user avatar
-1 votes
1 answer
149 views

recursive atoi | CS50

Greeting everyone! I've written the code of pset3 recursive atoi, but I'm facing an issue with the formula that converts the integer to its place value. To be specific it's in this line (number = ...
XxGOLDENELIXIRxX's user avatar
0 votes
0 answers
39 views

Tideman PSET03 - lock_pairs ERROR

I'm currently doing the Tideman PSET03 and I've completed almost everything except ``. Could you tell me why this is happening? It'd appreciated. Check50: https://submit.cs50.io/check50/...
AlvaroAndLukeTheCoder's user avatar
0 votes
0 answers
28 views

How to use .txt file with debug50 - pset3 tideman

Does anyone know if there is a way to store a bunch of data, e.g. number of voters and votes for the Tideman problem, as a .txt file, and then run that with debug50, so that I don't have to manually ...
Joseph J Filoramo's user avatar
0 votes
0 answers
18 views

Tideman - First Error of lock_pairs function is not working

I'm currently doing the lock_pairs function of tideman. I have completed most of the requirements of check50 in the lock_pairs function except :( lock_pairs locks all pairs when no cycles. I don't ...
AlvaroAndLukeTheCoder's user avatar
0 votes
0 answers
24 views

Tideman PSET03 - Add_Pairs errors!

I'm currently doing the tideman pset and i have some errors on the add_pairs function and the lock_pais function but I'm more focused now on the add_pairs function. I don't know why these errors are ...
AlvaroAndLukeTheCoder's user avatar
0 votes
1 answer
12 views

Is this a compiler issue maybe?

Ok, so It doesn't look like I have missed any brackets here. But then why is it giving me this error on line 71... I'll put in the code too in case someone would like to review it: #include <cs50....
Soham Roy's user avatar
0 votes
0 answers
32 views

Tideman PSET03 - Please Help Me!

I've been doing Tideman and I've completed every function required. But when I run Check50, it gives me some errors: add_pairs function did not produce 2 pairs , lock_pairs did not lock all pairs, ...
AlvaroAndLukeTheCoder's user avatar
0 votes
0 answers
20 views

Problem of pset3 plurality

This code can run, but the outcome isn't right.I checked many times, but I still can't figure it out.I wish someone can help me. Here is the function "print_winner" of my code:(I guess the ...
Lea's user avatar
  • 1
0 votes
0 answers
39 views

Tideman - sample votes

I am very close to solving the lock_pairs function in tideman. Everything passed, except that check50 is saying that :( lock_pairs locks all pairs when no cycles isn't working correctly. But it does ...
Joseph J Filoramo's user avatar
0 votes
1 answer
22 views

Hey. I was trying the Mario block programs(pset1), but for some reason I am facing an error during compilation itself

So, I followed all the correct steps for the zip file and everything worked fine, but I'm facing the following issue... Anyways, as you can see, I do have a file named mario.c in my current directory....
Soham Roy's user avatar
0 votes
0 answers
105 views

I don't understand the answer to the pset3 atoi practice problem

#include <cs50.h> #include <ctype.h> #include <math.h> #include <stdio.h> #include <string.h> int convert(string input); int number = 0; int main(void) { string ...
Harr's user avatar
  • 35
0 votes
0 answers
14 views

Sorting an array based on ints within a strut

I'm looking for a way to implement merge sort to sort the pairs[] array in the tideman problem. The problem being the array is made up of the strut pair, not ints. However, I have added an element to ...
Gavin Colonese's user avatar
0 votes
0 answers
24 views

vs code non running well pset3 plurality, execution does weird things

Does anyone else think that vscode is garbage? I am able to run a program correctly in another environment but in vs code it never runs correctly
MARS's user avatar
  • 5,179
0 votes
1 answer
68 views

Pset3 plurality print winner doesn't work

What's wrong with my code? The program works when I try it manually but when I check it for check50 it returns ":(" for all "print_winner" function. I spent a lot of time on this ...
e-zawadzka's user avatar
1 vote
1 answer
408 views

CS50 Pset3 - Tideman - I passed all the checks except for "lock_pairs skips final pair if it creates cycle". What am I doing wrong!

I am unable to pass the above-mentioned check. I can't see the issue. I would greatly appreciate if someone can share some insights. Code is below: // Lock pairs into the candidate graph in order, ...
Lacept's user avatar
  • 11
0 votes
1 answer
495 views

Outdated - Problem set 3

months = [ "January", "February", "March", "April", "May", "June", "July", "August", ...
Ritam Debnath's user avatar
0 votes
0 answers
68 views

pset 3 tideman - vote function - rank int

I am having trouble figuring out how to set up the rank integer in the vote function of pset3. I could do this to ask the user to rank the candidate, but I assume that wouldn't work with the sample ...
Joseph J Filoramo's user avatar
0 votes
1 answer
61 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
22 views

calling the first element in struct

I have defined an array of pairs of elements using struct and I'm trying to call (and sort) it using one of the elements (I'm not sure if element is the right term for it) for example, I have typedef ...
blueberry's user avatar
0 votes
1 answer
34 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
1 answer
62 views

Lock pairs function not locking for final pair, but works for middle pairs

I wrote the following code: void lock_pairs(void) { for (int i = 0; i < pair_count; i ++) { bool createsLoop = false; for (int j = 0; j < pair_count; j ++) { ...
Sarmen Ter-oganesyan's user avatar
0 votes
2 answers
77 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
166 views

split function in python seems to perform a strip as well?

I am following CS50P and I developed the outdated problem (last exercise in pset3) My code works ok, and I got 100% - all checks passed. However, I then checked for other solutions online to help me ...
thomas's user avatar
  • 103
0 votes
1 answer
63 views

Pset3 Fuel :can't split successfully when fraction containing 100

I am doing the Problem set 3 :Fuel Gauge. With every other fraction input the program works fine, but when I inputed 10/10, the program will can't detect /, and so that the program can't split the ...
Onion_in_Germany's user avatar
0 votes
1 answer
97 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
135 views

Tabulate function doesn't works properly (CS50x Runoff)

guys. I'm currently doing runoff (pset3) of CS50x, but I'm in trouble with the tabulate function. Here's the code: #include <cs50.h> #include <stdio.h> #include <string.h> // Max ...
Champs Legion's user avatar
0 votes
1 answer
221 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
62 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
1 answer
128 views

having problems with check50 in plurality

I seem to have a working program but whenever i run Check50 it gives me all green except for two of the lines which for some reason don't seem to think it works. #include <cs50.h> #include <...
Schmilp's user avatar
0 votes
1 answer
56 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
24 views

PSet3 Plurality - Segmentation Fault when exiting main

My code seems to function properly until I try to exit main. At this point it reports a segmentation fault. This only occurs when there is a tie. Here is my code: #include <stdio.h> #include <...
Thomas Gallaher's user avatar
0 votes
1 answer
87 views

Another Runoff issue with check50 on print_winner function

OK. I throw the towel. For the last 4 hours I have been getting the following errors in check50: :( print_winner prints name when someone has a majority print_winner did not print winner of election :(...
pampero43's user avatar
0 votes
0 answers
25 views

Any idea why I keep getting is_tie errors for this pset3 using check50?

I'm trying to figure out why I keep getting these two errors. I've created a new array called placeHolder to gather remaining candidates I have also created int newCandidateCount[1] to globally store ...
Akersar's user avatar
0 votes
1 answer
297 views

CS50 problem set 3, vote function problem

Good evening. I have a problem with problem set 3 (plurality) https://cs50.harvard.edu/x/2022/psets/3/plurality/ "vote" function always return "false". I tried different ways, but ...
Bagazega's user avatar
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
0 votes
2 answers
339 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
586 views

Tideman - "lock_pairs skips final pair if it creates cycle" - Almost there!

Getting good results in test cases. Hoping someone can point out where I'm going wrong! I'm also open to general code comments. // Lock pairs into the candidate graph in order, without creating cycles ...
monkdogz's user avatar
0 votes
1 answer
373 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
90 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
102 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

1
2 3 4 5
27