Questions tagged [cs50-pset1]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers
77 views

variable used in loop condition not modifies in loop body

im struggling with pset1 cash exercise, when im defining a calculate_quarters() and other in the same way i got an error. the task is to find out the number of quarters, dimes, nickels and pennies to ...
liza's user avatar
  • 13
0 votes
1 answer
19 views

Can someone please help me in resolving this issue. I don't quite understand what I am supposed to change here

Ok, so apparently there are no compilation errors. But what exactly is happening here. Like, why am I getting this error? P.S-Even help50 doesn't seem to be of much help here... The actual code is as ...
Soham Roy's user avatar
0 votes
1 answer
123 views

Dealing with pset1's "credit" problem

I was trying to solve this problem. I did some coding: #include <cs50.h> #include <stdio.h> int get_digit_number(long card_number); int main(void){ bool valid; long card = get_long(&...
user8633459's user avatar
0 votes
0 answers
78 views

CS50 Cash 2022 - Functionality / Prompt Bug

*I am incredibly new to all of this, it's possibly operator error due to lack of familiarity with the software I actually understand the math and the set-up of the code, but I don't understand VS code ...
Olivia's user avatar
  • 1
0 votes
1 answer
15 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? "); } ...
Sastri Rampersaud's user avatar
0 votes
4 answers
2k 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 ...
Tamz Hamz's user avatar
0 votes
1 answer
284 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: #...
Newbie86's user avatar
0 votes
1 answer
73 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 ...
vicraw215's user avatar
0 votes
1 answer
88 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 "...
Igor Roytman's user avatar
0 votes
1 answer
61 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 ...
shaneinei's user avatar
0 votes
1 answer
54 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. :( ...
Dhyey Patel's user avatar
0 votes
1 answer
198 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); ...
Olivia WU's user avatar
0 votes
1 answer
171 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.
nadasamy's user avatar
0 votes
1 answer
201 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> #...
Cassie Ng 's user avatar
0 votes
1 answer
91 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. ...
Ash's user avatar
  • 1
0 votes
1 answer
60 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> //...
Liz-Sod497's user avatar
0 votes
1 answer
38 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 ...
Soya's user avatar
  • 5
0 votes
2 answers
123 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 ...
JoeH's user avatar
  • 15
0 votes
1 answer
175 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 ...
naju's user avatar
  • 3
0 votes
1 answer
199 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(...
BadVariableName's user avatar
0 votes
1 answer
177 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 ...
KeleosWilliam's user avatar
0 votes
1 answer
498 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 ...
user23975's user avatar
0 votes
1 answer
851 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 ...
js94's user avatar
  • 3
0 votes
1 answer
39 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 ...
Aditya Anand's user avatar
0 votes
2 answers
153 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 ...
Robin's user avatar
  • 3
0 votes
1 answer
1k 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 ...
Alonso Martinez's user avatar
0 votes
1 answer
82 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 ...
arjun beniwal's user avatar
0 votes
1 answer
862 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 <
Salaidin's user avatar
1 vote
1 answer
480 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 ...
ironman19_'s user avatar
0 votes
1 answer
57 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 ...
Tommy's user avatar
  • 3
0 votes
1 answer
287 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 ...
kyldu's user avatar
  • 1
1 vote
2 answers
114 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); ...
Alex's user avatar
  • 13
0 votes
1 answer
35 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 ");...
Jerry Hou's user avatar
0 votes
1 answer
127 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 ...
NTM's user avatar
  • 1
0 votes
1 answer
270 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 ...
Der Traumwanderer's 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) { ...
Alice's user avatar
  • 1
0 votes
1 answer
42 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 ...
Ranjana Desai's user avatar