Questions tagged [pset1]

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

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

check50 says it's not authorized (it is)

Working on pset1 I have previously authorized my github for cs50.me. When I try to run check50 cs50/2017/x/hello, I get the error message "Looks like check50 isn't enabled for your account yet. Log ...
0
votes
1answer
157 views

Greedy. Help? I have no idea what to do

If anyone could give me any pointers on what is wrong with my code, it would be greatly appreciated! Also, any tips on how to be a better coder? Should I read more books / articles? Honestly, I am ...
1
vote
1answer
160 views

Program correctly responds to all the questions in gradebook but still not getting marks

My program for Greedy is correctly responding to all the questions in the gradebook but I'm still not getting marks. When I run check50 I get the following error: What should I do?
0
votes
1answer
209 views

Mario pset1 a little hand please!

Spoiler alert code inside this link! !http://imgur.com/OIHvPFC I am having trouble with the mario, any tips of how i can get on with this? I have listed my integers at the start but maybe i over ...
1
vote
2answers
889 views

pset1 mario: please help with my code

The below is what I have come up so far and the result is very underwhelming. It just doesn't work out as I expected. The first part works well but I am struggling with the second one. Any help would ...
0
votes
1answer
208 views

Greedy and Zamyla's pseudo-code

In the Walkthrough for Greedy.c, Zamyla asked if you can spot her error: > get amount in dollars > while (quarters can be used) increase count amount decrease by a quarter ...
1
vote
1answer
110 views

Is it compulsory to use the appliance Chrome while uploading pset files?

In pset specifications, it is instructed to submit pset through Chrome inside appliance, not any other. Is it compulsory? I mean, can't anyone submit through any other computer? Or any other browser?
0
votes
2answers
86 views

Problem Set 1: IDE

I'm very new to computer science and was attempting Problem Set 1 when I ran into some trouble and decided I wanted to start fresh. I ended up deleting all the files. Now I no longer have the /...
0
votes
1answer
14 views

CS50 Credit Pset problem- Code keeps looping back to ask for the credit card number

The following is my code for the Credit Pset from week 1 of CS50, it is not the complete solution to the problem (all the code does (rather is supposed to do) is for the user to enter a credit card ...
0
votes
1answer
533 views

greedy nested while loops works only for two line

I don't understand what is going on with my code for greedy. When I nest while loops for quarters and dimes, it gives me the right amount of coins used, but when I increase a similar while loop for ...
0
votes
3answers
37 views

:( handles lack of argv[1] failed to execute program due to segmentation fault

if (argv[1] == NULL) { printf("Usage: ./caesar key\n"); return(1); } this is the solution before the program received the first statement validate null
0
votes
1answer
161 views

I can get the correct height for my pyramid but I can't get the spaces or #s to add or subtract properly in my loop

{ for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { printf("%d\n", j); } for (int k = n; k < n + 2; k++) { printf("#"); } printf(" \n"); return (0); }
0
votes
1answer
86 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
370 views

Debugging problem caesar cipher pset1

I need some help with my debugging for the caesar cipher. I get these errors. [image replaced with actual errors produced by the code that follows] caesar.c:25:17: error: incompatible integer to ...
0
votes
1answer
133 views

Pset 1 Less comfortable - Number of Hashes

Sorry for the beginners's question. When I try to compile to following code for the Mario - Less Comfortable problem, I am printing the same number of hashes for each row and am unsure why. Code is ...
0
votes
2answers
119 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
55 views

pset 1 Question about difference between Mario and Cash (get_float get_n)

As I was trying to structure the user input section of both problems, I ran into some errors that I don't understand. For Mario, I separated the user input of the problem and int main(void) by placing ...
0
votes
1answer
66 views

pset1 credit: I am unable to identify what's wrong in the logic of my code?

Kindly tell me what mistake have I made in this program? pset1 Credit: (my code) https://pastebin.pl/view/5646dbf1
0
votes
1answer
459 views

How to check if a problem set is graded?

I submitted problem set 1 in the last week of August, 2014. How would I know if it has been graded? Snapshot: Why does it show "Ungraded?"
0
votes
2answers
45 views

Pset1 How do I get my code to compile as it should?

I'm trying to get my code to compile properly and it just won't. I know the code works when using a printf and scanf but now that I've changed it to get_int and printf it is not working properly. I ...
0
votes
1answer
40 views

Check50 giving different results from the code I compiled in pset1

For Problem Set 1, I have the code as written below #include <cs50.h> #include <stdio.h> int card_length(long cNo); void luhn_algo(long lacno, int lacnolen); void finalPrint(int cardDet);...
0
votes
1answer
81 views

How do you check if a number is integer as part of if statement?

As part of the Mario assignment following lecture 1, I need to determine is the number input is an integer. What function can I use to do that? I have tried scanf("%d", &number), where number is a ...
0
votes
1answer
14 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 ...
0
votes
1answer
45 views

the code which is expected and my actual code are the same but check50 see it as incorrect LAB1

#include <cs50.h> #include <stdio.h> int main(void) { // TODO: prompt for the start size int n; do { n = get_int("start size: "); } ...
0
votes
2answers
21 views

Why won't the last line of my code print?

So I am attempting to run this code, but for some reason my final print function is not printing to the terminal. Can you help me figure out what I am doing wrong? #include <cs50.h> #include <...
0
votes
1answer
73 views

Need help with my code! It will not compile and everything seems like it is correct. Please help and give me some pointers. Thanks in advance :)

#include <cs50.h> #include <stdio.h> #include <math.h> int main(void) { float f = get_float("How much change is owed: "); } float f = f x 100; int c = 0; while (f >= 25) ...
0
votes
1answer
93 views

Pset1 cash.c Can't seem to wrap my head around it

So I'm just trying to slowly navigate my way through this problem by seeing if I can get the total amount to subtract 25 from the float. I keep getting an error message that says cash3.c:18:27: ...
0
votes
0answers
22 views

Can someone please help me I am trying to find what is it I am doing wrong here in pset1

I am in the dir ~/pset1/hello but it gives the same error again and again it does not show anything in the ls command.
0
votes
1answer
14 views

Credit problem: Opening parentheses not matched with closing

Though it might appear annoying, the program not compiling. To the best of my understanding, there is a closing parenthesis on line 37. Is it some cache related issue? https://drive.google.com/file/d/...
0
votes
1answer
861 views

I keep getting error: use of undeclared identifier 'n' when trying to compile mario.c. I am new to coding, my code is shown below

#include <cs50.h> #include <stdio.h> int get_positive_int(string prompt); int main(void) { { int i=get_positive_int("Height:"); } for (int i = 1; i < n; i++) ...
0
votes
1answer
58 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
2answers
259 views

pset1 Mario trouble

I've been working on this for days now, and have reached a point where I'm afriad I've gone further away from the LOGIC of the problem. At the moment, the complier doesn't print out line 16 and yet ...
0
votes
1answer
198 views

Stuck at pset 1 mario problem

I'm Stuck at the PSET 1 problem of CS50. for height 3, my output is coming as ..# ..## ..### Can any peers or experts, look into my code and help me out. [EDIT: code removed for Honor Code ...
0
votes
2answers
39 views

Pset1 credit, checksum value gives wrong value

I find myself stuck on credit. Can't figure out where the problem lies in my logic. Checksum gives 4 where it should give out 0. Ideas appreciated. //calculate checksum value int sum1, ...
0
votes
1answer
33 views

Function in C: How to create

#include <stdio.h> #include <cs50.h> int main(void) { long creditcardno; do { creditcardno = get_long("enter"); } while (creditcardno < 0); } The above code accepts ...
0
votes
1answer
31 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 "...
0
votes
1answer
47 views

How to get my code to re-prompt when given a non numeric input?

So my code in C for the mario steps is correct except that it shows an output when foo is input rather than re-prompting for a valid integer. I did check50 and this was the only error. Where can I ...
0
votes
4answers
730 views

mario.c; error message: expected identifier

I have been trying for more than a week to correct compiling error: mario.c:19:1: error: expected identifier or '(' The response I received did not help. #include <cs50.h> #include <stdio....
0
votes
1answer
19 views

make: Nothing to be done for 'Mario'

I am confused.... :( Am I in the wrong directory?
0
votes
1answer
143 views

Problem Set 1 (Credit) - More Comfortable - 'Else' Block Not Running

I attempted Problem Set 1's 'More Comfortable' Credit assignment today, which is essentially to implement Luhn's mod 10 algorithm for checking that a given debit/credit card number is valid. I've ...
0
votes
1answer
83 views

Need help (or idea) making the code looks cleaner. (PSET1/CREDIT)

My code passed pset1/credit but I still think the there must be a way to make my code looks cleaner and more impact. If you have any idea please criticize the code. Thank you in advance. #include <...
0
votes
2answers
60 views

Why does this code sometimes give me a different sum when i run it for the same cc number?

I'm working on the credit problem in pset1, and this is only part of what should be done. All I'm trying to do here is to multiply every other number (from the cc number entered by the user) by two, ...
0
votes
1answer
96 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 ...
0
votes
2answers
33 views

pset1/credit outputs the right output but fails check

I'll share the printing part but not the calculation part, though happy to do that to it's just a bit lengthy. Nonetheless marked outputs are the right/expected output when run stand-alone but fails ...
0
votes
1answer
150 views

pset1 cash: greedy algorithm coin change round off

The output is not being rounded off: It doesn't count the cents value if you input a dollar in decimal. if it's $45.67, it only counts change for $45. Also, output comes back 0 if the input is ...
0
votes
2answers
51 views

why does this not allow coins =0.01 and greater?

{ float coins; do { printf ("please pick an positive number\n"); coins = GetFloat(); } while ( coins < 0.01 ); printf("%f", coins ); }
0
votes
1answer
62 views

HELP ME!! CS50 pset1 credit.c says INVALID but when I debug it says AMEX?

#include <stdio.h> #include <cs50.h> int main(void) { long long cc; //get user input for cc do { cc = get_long_long("Number: "); } while (cc <= 0); /...
0
votes
3answers
532 views

check50 is getting a different result from me on mario

I have tested every criterion of Mario, and they all are met, but check50 is getting a different output than me. Here is a transcript of what happened. elephant1123@ide50:~/workspace/pset1 $ ./mario ...
0
votes
1answer
50 views

Problems w/compiling pset1

Could anyone help me figure out why I can not compile, but get the following error: ~/workspace/pset1/mario/less/ $ make mario clang -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 ...
0
votes
1answer
38 views

function definition

#include <stdio.h> #include <cs50.h> int AnimalCategory(int); //function prototype int CurrencyCategory(int); //function prototype int ScienceCategory(int); // function prototype int ...

1
2 3 4 5
23