Questions tagged [pset1]

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

Filter by
Sorted by
Tagged with
26
votes
1answer
7k views

Greedy.c works for all numbers except 4.2

When testing greedy.c, all numbers appeared to work except 4.2 (annoying since 4.2 is in the check50 test). I get 22 coins instead of 18. I printed my variables at each stage of the problem and ...
5
votes
4answers
2k views

Completely lost.. pset1, Mario help

I am completely stuck. I'm not quite sure why I don't understand how to do this. I don't understand the hash tag and spaces thing. I have read so many explanations of it on this website, but none of ...
5
votes
1answer
1k views

How long to wait for being graded

How much time does it take to get our psets checked? It's been more than two weeks since I submitted my pset1, yet it hasn't been graded. (I am doing CS50x)
3
votes
2answers
50k views

Error: “make: *** No rule to make target `mario'. Stop.”

I keep receiving and the error message " *** no rule to make target 'mario' stop" when I try to make mario. Does anyone have any advice? I already typed in pwd and I'm in the Jharvard desktop. Any one?...
3
votes
2answers
2k views

How to Declare and Initialize Variables in C?

While I was watching the walkthrough for pset2 (capitalize), I noticed that David didn't declare a variable in his program. However, it still worked and I was wondering why. I tried to implement my ...
3
votes
2answers
13k views

Problem with “expression result unused” error in for-loop

There is obviously something missing in my understanding of the for-loop. Part of my code looks like this: int height; do { printf("Height?: "); height = GetInt(); } while (height < 0 || ...
3
votes
2answers
1k views

What's wrong with my do while loop syntax?

On pset1 I'm trying to make a do ... while loop to get the user's input for the pyramid height for Mario. I swear it should be simple... This is my source code for dowhile.c: #include <stdio.h>...
3
votes
2answers
215 views

How does a person make a character print more than once?

I've watched all the videos for pset1 and I cannot figure out how to make the space or indention print out more than once. Can anybody tell me where I'm supposed to find that kind of information? or ...
3
votes
2answers
145 views

Which loop can be replaced for nested for loops for PSET 1 (Mario More Comfortable)?

According to the cs50 style guide for C, more than 3 variables for iteration is not a good practice. I have done Pset 1 (Mario more comfortable) with 5 for loops, so it has 5 iterations variables. Is ...
3
votes
1answer
436 views

Unable to submit pset1

I am new to CS50. I am facing the problem with submission of my pset1. Whenever I open the link 'apps.cs50.edx.org/cs50x/2014/@/submit' in chrome, I get a blank screen with no option to upload the ...
3
votes
1answer
1k views

Infinite loop when validating input as integer

I am having problems with the error handling portion of the mario assignment. When I try to check if the input is a non-integer my program gets stuck on an infinite loop. Also, how should we check if ...
3
votes
3answers
3k views

Stuck on PSet1: I have the correct output, but Check50 says it's wrong

I'm stuck on the Mario part of PSet1. I've managed to write up my program and the output is always correct (or at least seems to be to me). I know it's definitely the loops that are making things ...
3
votes
1answer
140 views

My output for greedy.c is correct when I check it manually but not when I check it using check50

It says that ' input of 4.2 yields output of 18 \ expected output, but not "18" '. What is the difference between 18 and "18" ?! Here is my code: #include <stdio.h> #include <cs50.h> ...
3
votes
2answers
741 views

Problem with CS50 Problem Set 1

I have problems with problem Set 1. I submit last year programs greedy.c, hello.c and mario.c to your staff to check correctness. Yesterday I received assessment that program greddy.c is correct 3 ...
3
votes
1answer
766 views

pset 1 greedy: how to properly convert float to int

My problem is specifically how to convert the float that the user gives (dollars), into an accurate integer (cents). My code: printf("O hai! How much change is owed?\n"); float change_owed = ...
2
votes
2answers
8k views

Finding the nth digit for credit card number

I'm having a hard time trying to find the 2nd to last digit of the user's credit card number, since that's the starting point for Luhn's algorithm. Is there a way to convert a long to an array and ...
2
votes
3answers
130 views

My processor does not support hardware virtualisation for cs50 offline IDE

i'm new to programming and just started taking cs50.... I'd like to proceed to pset1 but i can't use the docker toolbox(i use windows 7) since my processor does not support hardware virtualisation. Is ...
2
votes
3answers
430 views

Getting error in pset1 mario more

In pset1 mario more problem i'm getting these errors. I don't understand the errors and how to correct this. :( handles a height of 2 correctly \ expected output, but not " # # \n## ##\n" :( ...
2
votes
3answers
3k views

How to approach Problem Set 1 Mario!

I'm really struggling with the First Problem Set 1 'Mario. Can somebody please just give me a hint as to where to start or where I can do more research? (Just Purchased Absolute Beginners Guide to C ...
2
votes
1answer
9k views

Stuck on pyramid for mario.c

I have the first part of mario.c done. The computer asks the user for input and then continues to ask if the user does not input an acceptable number. However I am unsure of how to print the #'s and ...
2
votes
1answer
1k views

Can't cast a float to an int?

For the life of me I cannot get this float to cast to an int, and I don't know why – I've tried a number of different things, including printing it as an int, which seems to have worked (printf("%d" , ...
2
votes
3answers
806 views

Why don't I get the correct result when dividing numbers for greedy?

I was trying to use the remainder operator (i.e.,'%') to get the remainder, but I ran into an error: n % 25 is not evaluated to 23 when the input is 9.73. Am I doing something wrong here? Or is it ...
2
votes
2answers
232 views

How to Convert Integers to Spaces/Hashes?

I am stuck at converting the integer input I get from the user into spaces/hashes. How to use this integer with my printf() function to print spaces/hashes?
2
votes
1answer
214 views

How do I fix the precision error for convering float to int?

I'm taking the input via float f = GetFloat(); I enter 4.2 I multiply it by 100 and print the integer and I get 419. This is my output O hai! How much change is owed? 4.2 n=419 22 How do I ...
2
votes
2answers
14k views

how do you run the program on CS50 IDE I looked at the manual previously described,no help

how do you "Run"the program on CS50 IDE
2
votes
1answer
2k views

confused about the round function

Firstly, the syntax... if I have a float variable called 'change_owed', why do I need to write: float roundf(float change_owed) what's the purpose of these two floats I have to write? Secondly, ...
2
votes
1answer
269 views

check50 rejects greedy even if the correct answer is displayed

When I run check50 on pset1 it does not validate my solution, even if it says that the expected output is the same as the correct output. Does anyone know what the problem is?
2
votes
1answer
306 views

Is Only check50 Being Used for Grading the psets?

I'm taking the course through edX and I've just received the grade for pset1. My grade was 0.39. Although my code has no problems, when I check it with check50, I get error messages. But not for code ...
2
votes
1answer
128 views

Greedy Check50 Error

I am getting this after I entered the value of 0 or negative: Expecting a prompt for standard input ... ... but received an exit code of 0 I don't know what do I do.
2
votes
2answers
1k views

PSET1:: Mario More Comfortable :: confused about check50 output

I am sorry if I miss something obvious here, but I am an absolute beginner. I get the following output from check50, which I am confused about: I will attach my code below, but my output for 2 is: ...
2
votes
1answer
68 views

time for change

im getting the error for 41 cents. The answer I get when i run the program is three coins i cannot figure out why. Can someone let me know if i did something wrong here? #include <stdio.h> #...
2
votes
1answer
263 views

My code seems to be working but check50 is giving me this “\ expected output, but not ”#\n“”

My code seems to be working but I keep failing on check50. As an example, I get this back from check 50: :( handles a height of 1 correctly \ expected output, but not "#\n" :( handles a height of ...
2
votes
1answer
563 views

check50 gives error “Expected output, but not ..”

Output errors of the check50 test gives me an interesting output: :( input of 0.41 yields output of 4 \ expected output, but not "4" And it does this for all the testing numbers. Since the output ...
2
votes
2answers
3k views

problems with long long variable type

I´ve been looking over internet and through the man cs50.h to find out why a simple program like this generates values error from 8 onwards, but i couldn't find why reads a value and stores another. ...
2
votes
1answer
171 views

Not seeing scores after submitting a while ago, what's wrong?

I submitted pset0 and pset1 about a month ago and still no scores. Is this normal or is something wrong?
2
votes
1answer
196 views

This is how i am translating this Pset1 mario code

This is the code I have, it works I don't know why and I have typed out my translation #include <cs50.h> #include <stdio.h> int main(void) { int height = 0; do { printf("...
2
votes
1answer
92 views

Mario program will not proceed past the spaces

I am having trouble getting the pyramid to print anything more than the first row of spaces, and the number of spaces it prints is not correct; for example, for a height of 4, it prints 4 spaces, not ...
2
votes
1answer
88 views

What's wrong in my greedy code?

I'm trying to solve greedy (pset1) problem. I wrote some code, it worked fine for certain numbers, but not others. check50: https://sandbox.cs50.net/checks/4e3a6f4684d24ab9a200253999b68c3e My code: ...
2
votes
1answer
170 views

How do I get past Chrome to submit assignments

I've got the three programs (hello, mario, and greedy) ready to submit but I can't get past Chrome, I have trouble remembering passwords, and they want to know the date I first signed up for Chrome. ...
1
vote
5answers
8k views

What's wrong with my code for mario?

I've been stuck on pset1 for five months now. I like to do things chronologically and mario has been giving me headaches. Every time I think I have the problem solved, I'm told it's wrong or a lot is ...
1
vote
2answers
76 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 ...
1
vote
2answers
163 views

pset1.greedy did not use modulo

I'm answering pset1 greedy I did not use any modulo but still got the right answers. Is that okay? Here's my code. #include <stdio.h> #include <cs50.h> #include <math.h> int main (...
1
vote
3answers
181 views

Screenshot for Pset1?

I received my grade back from Pset1 in Cs50X and it isn't what I expected. On some areas where I received a 0, it worked in my program when I inputed those numbers. I want to send a screenshot to the ...
1
vote
1answer
4k views

pset1 mario - declaration shadows a local variable

I can't seem to figure out what I'm doing wrong here. I'm getting the following error for the code below. Any ideas?
1
vote
2answers
1k views

Calculating the number of required coins in Greedy

This is the code I've got so far: #include <stdio.h> #include <cs50.h> #include <math.h> int main(void); { float x; x = userInput; printf("O hai! How much change is ...
1
vote
1answer
171 views

Hacker pset1 How to submit it?

Should one follow the same instructions to submit the hacker version than those of the normal version?
1
vote
1answer
2k views

Why does an input of 4.2 yield an output of 22 not 18?

I did all good in check50 .. except this one thing in greedy :( input of 4.2 yields output of 18 \ expected output, but not "22\n" This is my code
1
vote
2answers
88 views

pset1: mario - error msg

Newbie here. Apparently missing something here I can't even decipher the error message. Please let me know what went wrong! Thank you! int main(void) { int height; do { printf("...
1
vote
2answers
130 views

Pset1 Greedy Help Please

I think my way of solving Greedy is a little unorthodox, but let's leave that for another day. If i'm looking for an answer to $2.11 , it will output 8Q,1D,no nickels and pennies. I am assuming it is ...
1
vote
2answers
4k views

Login to CS50 IDE

I cant login to the IDE. I keep trying to use the EDX password I have, but it isn't working. I can't think of what else to do... Is anyone else taking the course online through Edx... Thanks, ...

1
2 3 4 5
22