Questions tagged [cs50-pset1]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
25 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 ...
0
votes
0answers
20 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. :( ...
0
votes
1answer
13 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); ...
0
votes
1answer
45 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.
0
votes
0answers
20 views

My terminal showed ^L

I tried to clear the terminal by pressing command K (i have a mac) and the entire thing was cleared but it showed ^L. I can't fix it no matter what I do :< help would be appreciated thank you.
0
votes
1answer
80 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> #...
0
votes
1answer
26 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. ...
0
votes
1answer
53 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> //...
0
votes
1answer
30 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 ...
0
votes
2answers
92 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 ...
0
votes
1answer
141 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 ...
0
votes
1answer
128 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(...
0
votes
1answer
148 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 ...
0
votes
1answer
293 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 ...
0
votes
1answer
712 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 ...
0
votes
1answer
33 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 ...
0
votes
2answers
76 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 ...
0
votes
1answer
902 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 ...
0
votes
1answer
75 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 ...
0
votes
1answer
743 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 <
1
vote
1answer
432 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 ...
0
votes
1answer
52 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 ...
0
votes
1answer
249 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 ...
1
vote
2answers
103 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); ...
0
votes
1answer
28 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 ");...
0
votes
1answer
117 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 ...
0
votes
1answer
249 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 ...
0
votes
1answer
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) { ...
0
votes
1answer
37 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 ...