Questions tagged [cs50-pset1]

The tag has no usage guidance.

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

Cash Not Compiling When Using Check50 Although I Removed Functions

My cash.c for pset1 compiles and runs as intended when I compile it, check50 knows the file exists, but it does not compile. I don't use functions, and it doesn't compile. Here is my code: #include &...
user avatar
  • 1
0 votes
1 answer
13 views

PSET1 Mario -The code builds the pyramid visually but getting errors with check50. Need help understanding

#include <stdio.h> #include <cs50.h> int main (void) { //Get input of height from user int n; do { n = get_int("How high should the pyramid be? "); } ...
user avatar
0 votes
1 answer
77 views

Cant get Codespace to work

Im up to the "Hello" module, week 1. Ive never programmed before so setting up copespace has been quite frustrating. I cannot get it to work. Can someone please help me? I want to get ...
user avatar
0 votes
1 answer
92 views

Pset1 Cash 2022, doesnt print out # of coins

At first I solved and it works only with user check and not check50, so I tried to add the calculate functions and the get_cents but it wouldn’t print coins anymore. Please help!! When it worked: #...
user avatar
0 votes
1 answer
35 views

CS50 PS1 Cash - If statement nested within while loop

I figured out how to solve this using an alternative method, however, when I tried to debug my original code where I nested if statements (along with various if else statements) within a while loop, I ...
user avatar
0 votes
1 answer
64 views

Caesar problem. Keep getting error of segmentation

The follow part of code worked perfectly, while I declared variables key_num and plaintext within if{}, but since I declared them outside (cause I need to use these vars later) I get the "...
user avatar
0 votes
1 answer
33 views

Credit (Pset1) - Do While Loop

I am still really new to C and programming in general(just started a week ago) and I'm having difficulty with the do while loop. My code doesn't run beyond while (ccNUM < 0);. I tried running ...
user avatar
0 votes
1 answer
32 views

PSET1 - credit ,not satisfying all test cases ,please help

These are the test cases which my code doesn't satisfy ,can someone please help me out as i have absolutely no idea why it is happening. Some tips or advice would be handy. Thank you in advance. :( ...
user avatar
0 votes
1 answer
33 views

CS50_Mario: How to fix: :( handles a height of 1 correctly expected ""#"", not "" "\n" #""

Here is my code, could you please help me? int main(void) { //ask user for the input int n; do { n = get_int("Height: "); } while (n < 1 || n > 8); ...
user avatar
0 votes
1 answer
108 views

CS50 PSET1 Hello, undefined reference to main

whenever i type clang hello.c it tells me that there is an undefined reference to main and i dont know how to solve this. please see the image to see my code and the error.
user avatar
0 votes
1 answer
144 views

Pset1 Cash less comfortable - not running for 0.41 and 0.01

-- hi im running into a problem with my code. It's executed pretty well with many inputs except for 0.41 and 0.01. It didn't print out any answer but just ran indefinitely... #include <stdio.h> #...
user avatar
0 votes
1 answer
49 views

Pset1 - Mario (less) - White Space

I am having a heck of a time trying to fix my error of "did you add too much trailing whitespace to the end of your pyramid?". It looks identical to me, but obviously I am missing something. ...
user avatar
  • 1
0 votes
1 answer
55 views

Coin count off by 1 in cash

When I input an amount into the program cash, it gives me one more coin than I should have and I'm not sure how to fix it #include <stdio.h> #include <cs50.h> #include <math.h> //...
user avatar
0 votes
1 answer
34 views

CASH issue - help needed

I've been struggling with this for a month now so any help will be appreciated. The program just returns the value of input, so although there are no errors in compiling, it doesnt actually produce ...
user avatar
  • 5
0 votes
2 answers
112 views

Pset1 Cash (in C) array increment error

Context; I'm trying to solve Cash by; Taking positive integer user input, saves as float "ch" for change. (this as an implementation detail) Create an array "coin_val" with coin value by descending ...
user avatar
  • 15
0 votes
1 answer
164 views

CS50 pset 1 cash problem: keep getting 1 as answer

I'm trying to do the CS50 cash problem and the answer keeps getting number 1 no matter which change I input. It won't accept negative numbers as asked by the problem, but I don't know why it doesn't ...
user avatar
  • 3
0 votes
1 answer
163 views

cash CS50 2020 pset1 modulo

I seem to be having trouble using modulo as conditions inside of while loops. int main() { float n; do { n = get_float("How much change is owed? "); } while(n < 0); int cents = round(...
user avatar
0 votes
1 answer
168 views

Stuck on CASH problem pset1

I need help on why this is happening: I'm currently doing the cash problem. I used get_float to get user's amount and then used round(amount_from_user * 100) to convert the float to int (i.e cent) as ...
user avatar
0 votes
1 answer
345 views

Hello.c pset1 problem, syntax error near unexpected token `(' and User input problem

Ive been doing pset 1 Hello and at the last part about User Input, Im at a loss for what to do. On the instructions, there are some hints where it says two commands. When I put down the two commands I ...
user avatar
0 votes
1 answer
828 views

Pset 1: Cash help

I've put together my answer for the cash problem set, but when I run the program and enter an amount for "change owed" it always outputs 1. Being new to all of this, I'm not sure what I'm doing wrong ...
user avatar
  • 3
0 votes
1 answer
36 views

CS0 pset1 Greedy not working for decimal inputs

I'm currently working on cs50's pset1 greedy problem and I've run into an issue. It seems the code works perfectly for all inputs except for those with decimals. I've even tried running the part of ...
user avatar
0 votes
2 answers
112 views

Not In Directory In Terminal Window pset1/mario/less

In the terminal window the current directory is always shown on the line where a command can be typed in. While working on pset1/mario/less somehow I have created the issue by which the current ...
user avatar
  • 3
0 votes
1 answer
994 views

Mario Half Pyramid - CS50

I have searched the forum for an answer to my question but the code from others confused me. My pyramid keeps printing upside down and I'm not really sure why. I am not looking for an answer but ...
user avatar
0 votes
1 answer
81 views

Incorrect mastercard number in pset1 cs50 2018 [duplicate]

according to Luhn's algorithm, 5105105105105100 is invalid as the total comes out to be 25, but the check50 cs50 says its valid. and in places, they starting to double the digits from the first digit ...
user avatar
0 votes
1 answer
803 views

PSET1: Can't check hello.c

Doing on https://ide.cs50.io typing check50 cs50/2018/x/hello hello.c in ~/workspace/pset1/hello/ $ And got Uploading.. Unexpected token <
user avatar
1 vote
1 answer
446 views

credit problem(pset 1) cs50

iam a beginner to programming and recently started cs50,in week1 there is a credit problem which stats: Implement a program that determines whether a provided credit card number is valid according to ...
user avatar
0 votes
1 answer
53 views

PSET1 Hello Score

This project seems so simple. I submitted a couple of times got 25 score, then fixed some things and got a 70. Really tried to improve this but now I can only get a 40? I have used the help50 it says ...
user avatar
  • 3
0 votes
1 answer
266 views

I finished pset1 mario.less but I don't understand my code

So I managed to finish pset1 mario.less but I'm really struggling to understand the logic behind my own code, the confusion comes into play once I get to the part where we begin building the half ...
user avatar
  • 1
1 vote
2 answers
113 views

PSET1 Mario More: Same output but still displays error

#include <stdio.h> #include <cs50.h> int main(void) { int block; do { printf("Height: "); block = get_int(); } while (block < 0 || block > 23); ...
user avatar
  • 13
0 votes
1 answer
31 views

Greedy, exit code 0, not 1

Here is the program: int main (void) { float dollar_amount =0; int quarter =25; int dime = 10; int nickel = 5; int penny = 1; do { printf("I own you ");...
user avatar
0 votes
1 answer
118 views

cs50 mario.c more check errors

I could not find the solution for my error on cs50 mario.c/more as my output shows perfectly fine on the terminal but i get check error which I don't understand please help: :( handles a height of 1 ...
user avatar
  • 1
0 votes
1 answer
263 views

Greedy(less comfortable) questions/thoughts/input/advice on my programm

Hello I am relatively new to programming and C in general. I have left the comments next to the points I have questions to, please don't give me any solutions, as I really want to learn and ...
user avatar
0 votes
1 answer
56 views

Pset1 Question Mario

So I figured everything out except why when I configure the program it doesnt print anything. No hashes no spaces! #include <cs50.h> #include <stdio.h> int main(void) { ...
user avatar
  • 1
0 votes
1 answer
39 views

pset 1 greedy- my code is getting stuck in do while loop. Why is it not take values like $.46?

I am working on pset1 greedy and my code is not working properly. if I put in the value .30 for float than it goes further. However, if I input .46 or 1.26 then it's getting stuck. Can you help with ...
user avatar