Questions tagged [pset1]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
250 views

My pset1 Water Code Works as per the Spec, but Doesn't Pass the Check50

so I am very new to this but I have written some code to complete the pset1 water task and it just won't pass through check50 2016.water water.c. I have put it below, I understand that it maybe all ...
0
votes
1answer
72 views

pset1 Cash question

For some reason sometimes it gets the answers right and others it gets the answer wrong, I'm stuck so I don't know what to do next. #include <stdio.h> #include <cs50.h> #include <math....
0
votes
1answer
148 views

cash.c I dunno which part is incorrect

I havent finished the whole, just the dollar part. But the formulation cannot be run correctly Can anyone tell me which part is incorrect?
0
votes
1answer
463 views

pset1 greedy: my code counts only quarters

After 2 days of getting the same result with pset1 greedy I am a bit desperate here to figure out what I am missing. My pset1 greedy compiles properly but it doesn't yield correct results. I ran ...
0
votes
2answers
274 views

Stuck on Mario Pset1

I'm stuck on Mario Pset1. I keep receiving line breaks, and the function seems to skip the nested for loops. #include <stdio.h> #include <cs50.h> int check(int b); int checktwo(int b); ...
0
votes
1answer
17 views

I have to enter any letter to get the result

I am currently doing the problem set 1 credit in cs50 program. I managed to write the code. It's compiles fine however once I enter the credit card number it stops, i must type any letter to get the ...
0
votes
1answer
237 views

RE: Credit in PSET1

I have come up with, what seems to me, to be a logical walkthrough of the CREDIT problem (after banging my head against a wall for too long) - but the code does not make sense to the compiler. And I ...
0
votes
2answers
172 views

Water code syntax error

I have been attempting to create the water code for pset1, but when I try to compile, it sends me an error message. I am wondering if my code contains a syntax error. Here it is: #include <stdio.h&...
0
votes
1answer
428 views

pset1 - Greedy Errors “error: expected expression”

Please help! I cant solve some errors (from: [http://docs.cs50.net/problems/greedy/greedy.html][1]) running this code: int main(void) { float change = 0; int coin_used = 0; int change2 = ...
0
votes
2answers
80 views

Can someone please tell me the errors?

#include <cs50.h> #include <stdio.h> int main(void) { float dollar; int penny = 1; int nickel =5; int dime = 10; int quarter = 25; int cent, change; int a, ...
0
votes
2answers
192 views

getting wrong output in pset1 in Greedy problem

I am working on pset1 greedy problem. I am getting wrong output. I have written just logical part here. x=getfloat(); x=x*100; if(x>=q) { count+=x/q; //q= quarter x+=x%q; } same for ...
0
votes
2answers
463 views

pset1 Mario. Spaces work, hashes don't and i can't see why

So I have been working on CS50's pset 1, making marios half pyramid. I have been looking over other problems on this site and I've gotten this far. But I can't seem to see what the problem is with my ...
0
votes
1answer
419 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
79 views

Understanding for loops and lingering questions I need answered before moving on!

I coded this and it passes. I just want to understand it much better than I do at this moment. I got hung up on a few of things and found the solutions online to those questions I was having but I ...
0
votes
2answers
315 views

VMware Fusion Product Key

I have downloaded VMware Fusion and more or less followed all the instructions provided, yet I could not locate the product key to activate the software. Does anyone know where I could find it?
0
votes
2answers
342 views

Pset1 Greedy problem

I thought I had made the right code the behind my logic was to first divide the number with 25 and keeps on dividing it until the answer is less than one which means it cannot be divided any further ...
0
votes
1answer
75 views

pset1 water how to ignore negative number

On the screenshot is the result after I typed a negative integer. How do I ignore the negative integers on bottles' result? Help pls. The positive & zero results are just fine, but the negatives ...
0
votes
1answer
63 views

My do-while loop does not work

do { number = get_long_long("What is your credit card number? "); } while((number < 1000000000000) || (number >= 10000000000000000)); This loop is not accepting inputs. I do not ...
0
votes
1answer
248 views

Why does “compiles” fail when checking with check50?

In the instructions, they were using Dropbox. I don't have Dropbox, so what should I do? update: Now I got my way through until the actual check. The 'exist' part is green (yay) but the compile part ...
0
votes
1answer
65 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
1answer
248 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 ...
0
votes
1answer
195 views

Still needing help with Mario pyramid construction

I can't figure out how to make the pyramid work. My current code from the //create pyramid onward is: //create pyramid for (int k = n; k+1<n; k++) printf("%d", k); printf("#"); ...
0
votes
1answer
266 views

pset1 - Mario less comfortable - Styling problem

Could any one please tell me what's the "styling problem" in this code? I keep getting score of 4 out of 5 and I don't understand what I miss ? #include <cs50.h> #include <stdio.h> int ...
0
votes
1answer
257 views

pset3: How to check for paddle edges?

When implementing breakout, i am having a hard time trying to figure out how to check if the ball hits the horizontal edges of the paddle. So far everything else works fine, but when the ball touches ...
0
votes
1answer
405 views

pset1 Mario Help?

So I understand the bases of the project, what I'm suppose to do etc, but when I prompt the user I get a bug, it also loops forever when I enter a negative integer is that normal? The do and while ...
0
votes
1answer
141 views

looking at why jenny's number is not a isbn number

I am looking at the problem and I was wondering how come jenny's number is not an isbn number, the sum adds to 253 and it is divisible by 11. I am kind of confused here
1
vote
2answers
1k views

pset1 mario pyramid

Below is my code for mario.c which compiles and prints the required pyramid but for some reasons didnt pass check50. // a program that recreates this half-pyramid using hashes (#) for blocks #...
0
votes
1answer
54 views

pset1 mario uncomf - Hash's start in wrong place

I've ran into what appears to be a problem. I initially thought I finished this pset but when I was checking my work I noticed the #'s always started from the 8th character along the line? Even if I ...
0
votes
2answers
183 views

pset1 mario Initializing for loop from GetInt

I'm running the Mario program and I have everything working except the correct count, which I can fix. The only issue I'm having is a syntactical one. I'm tying to initialize the "for loop" with the ...
0
votes
1answer
425 views

Greedy loop problem

I'm struggling with the "greedy" assignment from pset1. I tried to use division to get the amount of coins needed and modulo to get the remainder, wrote code with loops, it compiles and runs, it gives ...
0
votes
1answer
133 views

Mario syntax error

Something's wrong with my function declarator, and i have a different error that I don't understand at all. Please help! Here is the code: #include <stdio.h> #include <cs50.h> int n; ...
0
votes
1answer
113 views

Something wrong with my credit.c code

I tried writing code for cs50 pset1's problem: credit.c(more comfortable) after week2. My code is given below. The problem is that 'sumx' and 'sumy' are just 0 and hence 'sum' is always equal to 0. So ...
0
votes
1answer
278 views

Hacker pset1 credit.c always gives invalid?

I tried to attempt the credit.c problem. My code is as follows: #include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> int main(void) { printf("Please ...
0
votes
1answer
332 views

pset 1 mario space help

I am having a problem printing the spaces. The code I have gets the number as required. It prints out the number of hashtags desired based on user input. However, there are no spaces. Where can I ...
0
votes
1answer
852 views

What is “expected output, not an exit code of 0” on Mario check50?

Despite having the correct output, submitting Mario, did not getany credit at all. Went over previous Q & A's; didn't find similar issues. Height: 8 ## ### #### ##### ##...
0
votes
1answer
36 views

Pset1 Credit - Why is my code bypassing the Floor function inside If statement?

Here's my code- int f_1 = floor(N / 1000000000000000); int f_2 = floor(N / 1000000000000); int f_3 = floor(N / 100000000000000); int f_4 = floor(N / 10000000000000); if (...
0
votes
1answer
134 views

so im working on skittles pset and

skittles.c:6:1: error: expected identifier or '(' { ^ this is my error and this is my uncleaned up code #include <stdio.h> #include <cs50.h> int main(void); { int tries = (0); int ...
0
votes
1answer
418 views

Pset1 cash. Please help me understand my script. Only works for 35 cents

I am working on pset1 cash. I'm taking it step by step trying to work out the issues so I know the logic isn't complete but I would really like someone's input explaining why my script only works ...
0
votes
3answers
288 views

I'm having trouble printing the hashes and spaces. I've started with this, but it doesn't seem to work. Any ideas?

My code is down below. Everything above the for loop is fine. I need help with printing spaces and hashes. #include <stdio.h> #include <cs50.h> int main(void) { int h; do { printf("...
0
votes
1answer
231 views

My Pset1 greedy code produces no errors and the wrong answer

I changed all the "remaining" to cents and its didn't work. I still can't see the logic why I made the made the change. I want to understand this. Here is my code: #include <cs50.h> include ...
0
votes
1answer
2k views

Mario Less Comfortable, do-while loop problem

Hi everyone I made sure to do my research and go through the already posted questions. I am certain my while condition is wrong after research but don't understand the correction. my program runs but ...
0
votes
1answer
115 views

Problem with my credit.c code

My credit.c code keeps inserting huge numbers in my array for seemingly no apparent reason. For example the user enters 45231 for the credit card number, the beginning of the array is fine and ...
0
votes
1answer
453 views

for loop mario.c

This is what I have for Mario.c less comfortable. I am having a problem printing the pyramid. Am I suppose to have a for loop for every space, #, and newline. for everyline. #=1 #
0
votes
1answer
42 views

Can you tell me my mistake? ;)

Could anybody tell me what my mistakes are ? #include <stdio.h> #include <math.h> int main (void) { float dollar; do { dollar=get_float("Enter your ...
0
votes
1answer
580 views

pset 1 credit.c

I started with the credit card case but I am lost I wrote this till now I want some help to know what to do next of course not giving the whole thing because this is the purpose of the course... ...
0
votes
1answer
141 views

pset1: greedy Correct output when run in terminal but check50 shows different output

I am really frustrated with this error. I have been try all day, changing my code here and there but nothing works. Plz help me..
0
votes
1answer
22 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
2answers
139 views

Why isn't my block on pset1 turning into a staircase?

I am currently working on pset1 Mario, less comfortable. I am running my c to turn the hashtags into a staircase, but when I run the code, it is only a block. What is wrong with my code? Thank you all ...
0
votes
1answer
79 views

pset1 greedy.c check 50 programm error

I am wandering around for answers. But I end up that my code is correct ( I'm 90% sure :P ) #include <cs50.h> #include <stdio.h> int main(void) { double change; do { ...
0
votes
1answer
197 views

Vrtual Box error: low memory

I get this error when using VirtualBox: VirtualBox error ID: Host memory low; unable to allocate and lock memory, the virtual machine will be passed, please close applications to free up memory.<...

1
2 3 4 5
23