Questions tagged [pset1]

The problem set for Week 1 introduces the C programming language.

Filter by
Sorted by
Tagged with
0
votes
1answer
14 views

Question about Pset1 - credit

I had work on the credit for 3 hours, and I had reach to most of the function - and I checked that the number received from: Luhn (a) last digit(c) and digit count (cc) are right by using ...
0
votes
1answer
13 views

PSet1 Credit Invalid VISA that shows as Valid. My checksum must be wrong but dont know why

*/Here is the error I get: :( identifies 4111111111111113 as INVALID expected "INVALID\n", not "VISA\n" :( identifies 4222222222223 as INVALID expected "INVALID\n", not &...
0
votes
1answer
24 views

Help with Problem Set 1 Mario (less)

I have no idea what I am doing wrong here. Everything works just as specified, but for some reason I am still getting error messages. Please do not look at this if you have not already solved the it ...
0
votes
0answers
10 views

Stupid Q : where to submit files for free Harvard “cs50 class 2020”? [closed]

Im sure this is a stupid question but, what website (ide.cs50.io?) do the Harvard cs50 (2020 course) pset(x) files get submitted to 8?) Website (ide.cs50.io)? Command line IDE type (submit50 cs50/...
0
votes
1answer
11 views

Directory structures

I'm trying to create a new directory inside my pset1 directory. When I execute "~/ $ mkdir ~/pset1/mario" I get "bash: /home/ubuntu/: Is a directory". I think I need a better ...
0
votes
1answer
23 views

Cannot compile Mario (less comfortable) in PSET 1

I have finally made code that works and allows itself to be "made". However when I try to compile the code to submit it, it presents me with an error that says "undefined reference to '...
0
votes
2answers
32 views

PSET 1 Credit; Sometimes Check50 works and other times it doesn't

Why does Check50 work for certain credit numbers and not others? I ran debug and found that for some credit numbers and not others it may randomly be always one away from a multiple of 10 preventing ...
0
votes
1answer
26 views

Can't submit or check

I'm trying to upload my assignment, but I keep getting the same error whenever I run the check50 or submit50 command: "Make sure your username and/or password are valid and submit50 is enabled ...
0
votes
1answer
29 views

pset 1 - cash problem - No errors, am rounding, but still not always correct amount of coins

I'm having trouble finding out where the problem with my code is on the Cash problem in the CS50 problem set 1. In the other questions for this problem on this forum it often seems to be the round() ...
0
votes
2answers
20 views

I cannot get the CS50 IDE to run clang for lesson 1

While trying to follow along with the professor during lesson one, I cannot get the CS50 IDE to run clang. I have tried renaming the file, restarting the program, and deleting and starting the code ...
0
votes
1answer
16 views

Why doesn't my code give me an output?

So I am very new to CS and I have been working hard twisting this code around in my mind trying to figure out why nothing happens when I run the program. It compiles fine, but whenever I put in any ...
0
votes
1answer
27 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
21 views

I keep getting “expected EOF” when I use check50

this is the message identifies 4111111111111113 as INVALID expected EOF, not "INVALID" this is the code #include <cs50.h> #include <stdio.h> #include <string.h> #include &...
0
votes
1answer
16 views

My code is not compiling

my code isn't compiling and i don't understand the error message #include <cs50.h> #include <stdio.h> #include <string.h> #include <stdlib.h> bool checksum(string credit); ...
0
votes
1answer
75 views

CS50W - Wiki with Django - I want to edit a wiki entry, but I don't know how to send the default value to the template if I use Django forms

I've tried to do this: class editPage(forms.Form): title = forms.CharField() textContent = forms.CharField(widget=forms.Textarea(attrs={'class' : 'textContent'})) def edit(request,name): ...
0
votes
1answer
12 views

When I multiply my array by 2 it doesn't give expected value

Also, please when I try to add "firstnumsum", it doesn't give expected value and I don't know what to do. #include <cs50.h> #include <stdio.h> #include <string.h> #include &...
0
votes
1answer
37 views

PSET1 Cash - less comfortable - errors only for 0.41, 0.15

I hope you can help me with the PSET1 task - cash - less comfortable. Here is my code but I cannot figure out why - when testing the code - only 0.41 and 0.15 deliver wrong outputs (8 instead of 4 and ...
0
votes
1answer
35 views

i don't know what's wrong with my code. Trying to convert from string to long

INPUT int main(void) { long long cardnumber, calc; string credit[0]; string nonnumeric; //long long calc = card number; int countcardcharacters = 0; long long c; //user input do { credit[0]= ...
0
votes
1answer
19 views

Pset1 Creating and Changing Directory Does Nothing

For the first problem set, I attempted to create and change the directory with the following commands: $ mkdir ~/pset1 $ cd ~/pset1 $ mkdir ~/pset1/hello $ cd ~/pset1/hello Despite doing these ...
1
vote
2answers
85 views

pset1 (mario, more) - problem with unwanted leading spaces

This is what check50 gives me: > :( handles a height of 1 correctly > expected ""# #"", not "" "\n"# #"" > :( handles a ...
0
votes
1answer
31 views

Error Code - Use of undeclared identifier in PSET 1, Mario

An error code popped up while trying to compile my code, saying that the variable n had not been declared earlier. It had been declared however at the beginning. Here is the code and the terminal ...
0
votes
1answer
24 views

Query related to Mario program(more) in CS50 pset1

I can't figure out the problem in my code, it successfully creates a pyramid but doesn't reprompt when value other than 1-8 is entered, also it gives a space before printing the pyramid, causing ...
0
votes
1answer
21 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
1answer
14 views

My program doesn't run when i close the condition's range. When i leave the range open it does't give the answer i want

#include <cs50.h> #include <stdio.h> #include <math.h> int main(void) { float change; int cents = 0, coin_number = 0, quart = 25, dime = 10, nickel = 5, penny = 1; //...
0
votes
1answer
20 views

Making code neater: a way to reduce repeated logical operators?

For CS50 pset1 Credit I'm using repeated logical-OR operators (||) to work out the validity and card brand of a credit card number. When I evaluate the style of my code using style50 it says to insert ...
0
votes
1answer
42 views

This is my code for cash

This is my code for cash idk what I did wrong cuz when I compile it, it gives me a decimal of the number I put in instead of a whole number representing how many coins. Idk what I did wrong. #include &...
0
votes
1answer
24 views

My code does what I want it to do, but I get errors with check50 (PSET1, MARIO, LESS)

When I run my code in the terminal it gives me the correct response. However, check50 indicates there is an issue with my spaces. I have spend 2 days looking at it but I dont know whats wrong. INPUT /...
0
votes
1answer
30 views

pset1 less greedy - keep on getting errors

I have added a first version of my code, however it is unable to compile and I just cannot figure out why. INPUT #include <cs50.h> #include <stdio.h> #include <math.h> int main(void)...
0
votes
1answer
40 views

cash less comfortable

I've been working on my cash problem but it keeps giving me error on the code especially the variables and I don't know why.
0
votes
2answers
65 views

mario less comfortable help

I wrote this code for the mario problem but idk if it's right. i'm having trouble running it. It keeps saying error: linker command failed with exit code. #include <cs50.h> #include <stdio.h&...
0
votes
2answers
23 views

rejects a height of 9, and then accepts a height of 2 expected “” #“\n”##“”, not “”

This is my solution for the cs50 pset1 (less). Passes ok all the test cases except for the "9 then 2" case. I tried it in the IDE myself and after passing 9 and the any other integer the ...
0
votes
1answer
58 views

Unable to compile pset1. Mario (Less comfortable)

I am unable to compile my file and get many errors. INPUT #include <cs50.h> #include <stdio.h> int main(void) //Prompt for the height of the pyramid int height; height = get_int (...
0
votes
1answer
36 views

My 'pset1 Mario more comfortable' is returning check50 errors whilst seemingly correct

I saw this question has been asked in multiple ways before but I believe I've checked answers and am still stumped as to the issue I have. The output for my pset1 Mario more comfortable appears to be ...
0
votes
1answer
20 views

PSET1 Cash, .41*100=0?

When I take the user input in dollars (as a float) and multiply it by 100 -- even when I then save that value as an intermediate float "cents" before changing it to an integer, for some ...
1
vote
2answers
25 views

ERROR PROBLEM SET 1- CS50 LIBRARY

I have included the cs50 library however, I am still getting an error. Input: #include <stdio.h> #include <cs50.h> int main(void) { printf("hello, %s\n"); } string name = ...
0
votes
1answer
56 views

PSET 1 Less comfortable Mario

I have been writing this code for a day but I still could not get the result I want, I don't even know how the is giving me a weird result. Here's my code: #include <cs50.h> #include <stdio....
1
vote
1answer
59 views

PSET1 Mario pyramid - Can someone explain me the logic of this line of code?

I was able to make the Mario's pyramid from Problem Set 1, (I know it should be right alligned, not left). This is the code, and it is working fine when I execute the program, but I don't seem to ...
0
votes
1answer
25 views

Errors on Mario pyramid

I thought had solved the Mario Pyramid problem until I got back all these errors :( handles a height of 1 correctly Cause expected ""# #"", not "" # # ..." :( handles a height of 2 ...
0
votes
1answer
14 views

Syntax Highlighting Error

I am working on my mario problem. I write my code in C, but it's not getting highlighted, meaning the program doesn't understand it. How can I get it to understand my code? for example #include is in ...
0
votes
1answer
49 views

Says that ./hello is a directory and error code when say clang -0 hello hello.c

I was following the directions from the website and was putting clang -0 hello hello.c I got an error code. I'm not sure if this means anything but when I put ls it says a.out* hello/ and hello.c. ...
0
votes
1answer
55 views

Greedy Algorithms PSET1. I wrote this code but at some cases it fails to give the correct output. Can someone please help me.?

#include <stdio.h> #include <math.h> int main(void) { float dollar; do //Loop to prompt user to type positive value { printf("...
0
votes
2answers
87 views

Problem Set 1 help, clang hello.c, and ls (list)

When I follow the directions from Problem Set 1 on the website, I get an error code when I type in clang hello.c and when i type in ls the list doesn't show up. Before I made the new file so I could ...
0
votes
2answers
62 views

PSET1 - Credit: Check50 says wrong what should be right

Someone with the same problem? I have a 16 digit number starting with a 4 and my code identifies it correct as VISA\n, but the check50 says it has to be INVALID\n. What could cause this strange ...
0
votes
2answers
50 views

Do - While loop

I am trying to do the Mario problem with C. The issue is that I want the user to select a number from 1 to 8. So my boolean expression is (n < 9 && n > 0). But I don't know why is not ...
0
votes
2answers
78 views

Incorrect output by check50

I worked very hard on Cash and finally produced compilable code and correct output. But when I ran check50 I got these results, shown here. Please help. My code is shown below, in case you need it. #...
0
votes
1answer
43 views

Cash.c:11:24: error: expected expression

#include <cs50.h> #include<math.h> int main(void) { int n = 0; do { n = (get_float("Change owed: ") * 100); } while (n < 0); int q = ((n / 25) %) ...
0
votes
1answer
28 views

Check50 issue pset1

This is the link that compares my output to expected output. https://submit.cs50.io/check50/cd17b70a3e377bfa9f3fabdff9d64aa91c23d9b3 Isn't it exactly the same. Still CS50 bot keeps rejecting it.
0
votes
1answer
38 views

"Error: Expected identifier or '(' in cash.c

#include <cs50.h> #include<math.h> do { int f = round((get_float("Change owed: ") * 100) } while (f < 0) q = ((f / 25)%) d = ((q / 10)%) n = ((d / 5)%) c = (n%) i ...
0
votes
0answers
18 views

I got a “linker command failed with exit code 1” error after compiling my source code

clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow mario.c -lcrypt -lcs50 -lm -o mario /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/...
0
votes
2answers
50 views

Pset1 Program does not stop printing dots dots/spaces for the pyramid and I don't understand why

After a certain number of iterations through the loops (lines 16 to 21), I expect the program to stop printing out dots since the "dotcount" should be equals to 0. However, an unnecessary dot is still ...

1
2 3 4 5
22