Questions tagged [pset3-helper.c]
The pset3-helper.c tag has no usage guidance.
29
questions
0
votes
2
answers
44
views
Pset3, Issue with duration in helpers. Can't compile, strange error message
Back again, this time trying to figure out pset3. I think everone is familiar with the pset, but for anyone who isn't, I'm trying to convert a fraction (1/8, 1/4, 1/2, etc) to a number of eighths.
...
0
votes
1
answer
80
views
Calculate n (semitones) for frequency in pset3
I'm having a bit of a hard time trying to calculate the value of n(the number of semitones from A4).
I'm currently using the following formula:
if (octave > A4_OCTAVE)
{
n = (octave - ...
0
votes
1
answer
29
views
Pset3 Music random interger stored
I am writing the frequency function for pset 3, and I'm taking the input string note and storing the character that denotes the octave number in an integer called octave1. I've been getting some ...
0
votes
1
answer
3k
views
pset3 frequency "called object type 'int' is not a function or function pointer" (line 108)
I'm not sure what is wrong with my code or why I'm getting error "called object type 'int' is not a function or function pointer" (line 108) thank you for helping!
0
votes
1
answer
103
views
Pset 3 Music. Brute forced the frequency function, no syntax errors but only getting 0's for all my answers? Any Ideas?
I know my code is not clean at all. For the frequency function I just brute forced it by just starting with "what if there were only A's?" and copied that for the rest of the letters. Naturally messy ...
0
votes
1
answer
56
views
Pset3 2017 less bubble sort
I decided to do pset 3 from 2017 as extra practice, but ran into an issue with bubble sort. More specifically, when I run check50 on it I get:
:( sorts {5,4,3,2,1}
expected "1", not "\n5\n5\n5\n5\n5.....
0
votes
1
answer
125
views
Pset 3 helpers.c check 50 errors
#include <cs50.h>
#include <stdio.h>
#include "helpers.h"
//TODO binearysearch, om te controlere van de waarde.
bool search(int value, int values[], int n)
{
int left = 0;
int ...
0
votes
1
answer
141
views
pset3 bubble sort
pls could anyone tell me where have i made the mistake?...as i have tried to find it myself but couldn't find it.
void sort(int values[], int n)
{
int min=0,max=0;
do{
//to compare ...
0
votes
2
answers
2k
views
Pset 3 - Timing out issue with helper.c
Updated with the solution on the bottom of this post. Thanks MARS for your help you got me headed in the right direction and I eventually got there.
I'm close to completing the helper challenge (less ...
0
votes
1
answer
58
views
pset3(count sort):can't sort using count sort,it doesn't sort at all or not returning the sorted array??plz help
/**
* helpers.c
*
* Helper functions for Problem Set 3.
*/
#include <cs50.h>
#include "helpers.h"
#define bound 200
/**
* Returns true if value is in array of n values, else false.
*/
...
0
votes
1
answer
54
views
Direction on Find/Helpers.c
I am really struggling to get started on the first part of Pset 3. I was able to do the commenting for generate.c (though without getting a deep understanding of srand and drand functions, which I ...
0
votes
2
answers
189
views
Pset3 helpers.c
i'm stuck in binary search. Check50 doesn't pass all the checks and it doesn't find the needle, I feel like the algorithm i have implemented is correct but it doesn't work. I've been stuck in this for ...
0
votes
1
answer
16
views
helpers.c output error
Why is this program not returning true when value is in values?
bool search(int value, int values[], int n)
{
// TODO: implement a searching algorithm
int start = 0; int end = n-1; int k = 0;
//...
0
votes
1
answer
76
views
pset3 helper.c segmentation fault
in the last check of check50
when i entered these numbers and in that order 42 40 39 41 it gives me segmentation fault
but when i put printf in my sort functions it runs normally
so can someone ...
0
votes
1
answer
105
views
My helpers.c [pset3] passes check50, but not working in real world
I wrote helpers.c according to Zamyla's walkthroughs. My code seems quite well to me. I checked it with check50 and it passes.
~/workspace/pset3/find/ $ check50 2016.find.less helpers.c
:) helpers.c ...
0
votes
1
answer
73
views
CS50 > Pset3 > Game of fifteen > init function :
Can anybody please explain why is the rule: 1 and 2 has to be swapped when the dimensions are even? Why is it necessary? what is happening behind the screen?
0
votes
1
answer
94
views
Pset3 Find - Not sure what is wrong with helpers.c code
I am not sure what is wrong with the code. It seems to work on some of the criteria when using cs50's check50, but does not work on others. There also does not seem to have a pattern about the wrong ...
0
votes
1
answer
411
views
Need help with pset3 find program
This is my find.c main function
int main(int argc, string argv[])
{
// ensure proper usage
if (argc != 2)
{
printf("Usage: ./find needle\n");
return -1;
}
// remember needle
int needle = ...
0
votes
1
answer
226
views
Pset3 - Problem with Bubble Sort
I've tried to write an implementation of bubble sort.
I deliberately created it in a separate file outside of helpers.c, just to make sure it works, before incorporating into helpers.c
It doesn't ...
0
votes
1
answer
56
views
pset3 buble sort() function works but it gives wrong output in helper.c
this is my bubble sort program which works fine:
#include <stdio.h>
#include <stdbool.h>
/**
* Sorts array of n values.
*/
void sort(int values[], int n)
{
bool no_swap = false;
...
0
votes
1
answer
95
views
<Pset3 Find> Help with Selection sort code
I can't seem to see the problem with my code for Selection Sort. I'm passing all the checks for check50 except the one with an unsorted array so I'm guessing that the problem lies with my Selection ...
0
votes
1
answer
48
views
Pset3 helpers.c while loop exiting unexpectedly
I am trying to implement a binary search algorithm. However, my while loop isn't working as expected. Having used printf and debug50 with a list of 100 numbers, it seems that the while loop only gets ...
0
votes
1
answer
194
views
pset3 helpers.c doesn't compile
When I run check50 it states that helpers.c doesn't compile, but it finds the numbers correctly in the arrays. I'm lost. Any help is appreciated.
~/workspace/pset3/find/ $ check50 2015.fall.pset3....
0
votes
1
answer
118
views
pset3 - Binary search not finding the element in middle
Binary search doesn't seem to find the element in middle.
int binary_search(int value, int values[], int n) {
int low = 0;
int high = n-1;
while( high >= low )
{
int mid = (...
0
votes
1
answer
95
views
pset3: How to test sort function code using passed array and printf in independent file
I just wrote some code for a bubble sort function. I would like to test it using a simple printf with an array of values passed into it but am struggling. For now, let's assume that this file is ...
0
votes
1
answer
51
views
Pset 3: What's wrong with my binary search code?
I've tried using "./generate 1000 50 | ./find 127" and it doesn't find a needle so I guess my code is wrong. I'm not sure if it is my search function or sort function or both that are wrong. Here's a ...
0
votes
1
answer
25
views
Practicing my source code
hi am trying to run my code but it keeps giving me this error.
~/workspace $ make Practicing
clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wshadow Practicing.c -lcs50 -lm -o Practicing
Practicing.c:4:...
0
votes
1
answer
23
views
Binary search: always false when 2 or 3 numbers entered
My binary search works correctly when you enter 1,4,5,6,7 (etc)... numbers or 'haystacks'. However, when 2 or 3 numbers or 'haystacks' are entered, false is always returned. I have tried everything I ...
0
votes
1
answer
740
views
Pset3- Find: "control may reach end of non-void function" (error)
I know that this question has been asked before, but none of the answers have helped me. I keep getting the "control may reach end of non-void function" error when I try to make find after editing ...