Questions tagged [pset1]

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

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

Cant compile code. Keeps producing an error that says 'change -quarter' 'change - dime' 'change -nickles' 'change - dime' is unused

#include <stdio.h> #include <cs50.h> #include <math.h> int main (void) { float o; // Float 'o' represents money owed before conversion to cents. int quarter=25; int dime=...
kingfeel's user avatar
0 votes
0 answers
23 views

Is usage of many header files will increase the memory usage?

In my program I had used four header files, but actually I need only two. Does that consumes more memory or is it is an overhead?
NIKHIL KURIAKOSE's user avatar
0 votes
3 answers
547 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 ...
Elephant1123's user avatar
0 votes
1 answer
165 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); }
Aaron Lambert's user avatar
0 votes
1 answer
224 views

Unexpected errors while assigning variables

I just began taking the CS50x course, and while tweaking the programs used on the lectures I came accross a very unpleasant obstacle. I followed the exact same steps and recreated the exact same ...
Matheus Fonseca's user avatar
0 votes
2 answers
353 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 ...
Furrukh Jamal's user avatar
0 votes
1 answer
146 views

Question from Book chapter six

before starting Pset1, I was trying out the exercise at the end of every chapter. In chapter six there is a question where you have to input a number say 1234 and the program must output the same ...
Furrukh Jamal's user avatar
0 votes
1 answer
35 views

Dooker toolbox error something not enabled in BIOS

I installed the docker app and when I ran it for the first time during setup it gave an error of VTX-AMD not enabled from the bios...what should I do?
Furrukh Jamal's user avatar
0 votes
1 answer
296 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 ...
user107224's user avatar
0 votes
1 answer
141 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; ...
Elephant1123's user avatar
0 votes
1 answer
223 views

Mario pset1 a little hand please!

Spoiler alert code inside this link! !https://i.stack.imgur.com/MWKeJ.jpg 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 ...
Euriloco's user avatar
0 votes
0 answers
164 views

I have a error during compilation of pset1 water.c

Any idea why this error is showing clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wshadow water.c -lcs50 -lm -o water
Bijo Joseph Abraham's user avatar
0 votes
1 answer
56 views

Help with greedy pset 1

I don't know what is wrong with my code. I keep inputting 0.41 and getting 8 as the answer. #include <cs50.h> #include <stdio.h> #include <math.h> int main(void) { float x; do { ...
BB8-2597's user avatar
0 votes
1 answer
236 views

Check50 Problem with ItsaMario

When I execute check50 it says I have some errors in my code. :) mario.c exists :) mario.c compiles :) rejects a height of -1 :) handles a height of 0 correctly :( handles a height of 1 correctly \ ...
BB8-2597's user avatar
0 votes
1 answer
198 views

For Loops in Itsa Mario pset1

I don't understand what to put in for the (initialization; condition; update) part of the for loop. I used 4 variables in my code: i = height, r = rows, j = spaces, n = hashes. Whenever I type in "...
BB8-2597's user avatar
0 votes
1 answer
869 views

Help with Mario's half-pyramid

I am stuck on how to build Mario's half-pyramid. I know that you can use a for loop to create the spaces and hashes. Whenever I try to execute the for loop, it doesn't print out the hashes or spaces. ...
BB8-2597's user avatar
0 votes
1 answer
121 views

Simplifying "Greedy" Code

My code for "greedy" works, but it's annoyingly repetetive and long. I know there must be some way to simplify it, but I'm at a complete loss as to how to do it. This is my code: int main(void) { ...
creative_name's user avatar
0 votes
4 answers
769 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....
Ben Breslauer's user avatar
0 votes
0 answers
136 views

Pset1 No rule to make target 'water'

I wrote my code and I am using the appliance online. The appliance version is 19 so even though this question has been asked about mario and hello, there are no instances of the water pset found. ...
Marlies L.'s user avatar
0 votes
1 answer
102 views

Pset1 How do I indicate that I want to print a blank space?

I'm working on the Mario problem and believe that I have an understanding of how to code it. However, I don't know how to go about making a "blank space" (like when the space bar is pressed) within ...
Tamara Thomas's user avatar
0 votes
3 answers
297 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("...
user avatar
0 votes
1 answer
51 views

pset1 how to get ###'s on the right side?

I am real new to computer science and enrolled in CS50. I am having a very hard time with Mario. I am sure that I will be able to form the pyramid and write in the proper loops but, I have no clue at ...
Ellen J. Clarke's user avatar
0 votes
0 answers
117 views

pset1 check50, help with the code [time for a change] all outputs are correct except one

All the outputs are correct except one. Tried for loops, while loops, even if loops, but it won't just solve the problem. :< [code edited away per academic honesty guidelines] harvard@ide50-...
Michael Daryl Mayo's user avatar
0 votes
1 answer
94 views

PSET1 Greedy passed every check except "input of 23"? Why it doesn't work with integers?

So if a pass a float like 0.41 i receive "4", as expected. And that's work with any float number. But if i pass an integer like "2" or even "2.00", program stuck and ask for input again. Here is the ...
Ilia Shcherbakov's user avatar
0 votes
1 answer
281 views

mario.c infinite loop

int main(void) { printf("Number of blocks: "); //prompts the user for number of blocks int n; //height do { n = GetInt(); } while ( n > 23 || n < 0); ...
Gabriel's user avatar
  • 97
0 votes
2 answers
506 views

Mario program compiles and work but cs50 check gives error

I was so happy that I finally finished the mario en greedy pset. It compiled and worked fine. But when I try to check the mario pset with cs50 check, it gives me these errors: :) mario.c exists :) ...
Bram  Vanbilsen's user avatar
0 votes
1 answer
369 views

Is this what the Mario project should look like?

Hi guys, So I think that I finished my Mario project, but I'm not sure. To be more precise, I'm not to sure if my "spaces" or coded correctly. Like you can see, there is always a pretty big gap ...
Bram  Vanbilsen's user avatar
0 votes
1 answer
53 views

virtual machine doesn't power on

i just installed cs50 appliance but when i tried to power on the virtual machine this message appeared anyone can help me please?
Asmaa 's user avatar
0 votes
1 answer
223 views

PSET1 mario and CHECK50

I was just wondering the cause for the reason why mario.c fails to take a value of 1, 2 and 23 and rejects 24. In my tested version, it manages to successfully print out the expected output and it ...
Brandon Wang's user avatar
0 votes
1 answer
86 views

Pset 1 issue: reprompting user for GetInt() despite nested for loops

I am very close to finishing pset1 but there's just one problem: the user needs to keep entering the height of the pyramid in order to keep printing the rest of it. This is what I essentially have to ...
dontnonuff's user avatar
0 votes
1 answer
141 views

What's wrong with my code?

Recently I stuck in this particular Pset. It appears I followed all the instructions, but when I try to run this code it simply doesn't print anything. Any suggestions? Thanks, here's my cOdE: ...
Paul_1898's user avatar
0 votes
1 answer
232 views

Help getting past mario.c compiling errors

I'm pretty sure I have the logic of this problem figured out, but I have spent two weeks working every day struggling to get my code to compile so that I can actually test what I've done. I keep ...
Dagny's user avatar
  • 3
0 votes
1 answer
82 views

Why my code is not accepting some of the floating values

Below is my code which is supposed to print the number of coins needed as per greedy algorithm. Here when I enter, let us say 5.5, it outputs 22 which is fine. But when I enter 5.6 or 10.6, the ...
Rajeshwar Singh's user avatar
0 votes
3 answers
70 views

The programs for PSET1 works fine on my computer but receives low grades

I pended the code for Mario and Greedy days before. The grades I received are terrible even though I'm 100% sure the code works just fine on my computer. Here is the code for Greedy #include <...
Yi Hong's user avatar
0 votes
1 answer
59 views

Greedy It compiles but i think it doesn't get the float

I tried changing from float to int, but is still the same no matter if i input a integer or a float the program still seems like it doesn't receive anything. i think my problem might be on the while ...
user9689's user avatar
0 votes
1 answer
78 views

Pset1 greedy.c compiling issue

I'm having a compiling issue with my code and I can not figure it out. It is saying that my variables are not initialized in a few areas. Can someone help me figure out why this may be? I've tried ...
vslateart's user avatar
0 votes
1 answer
119 views

Any looping in greedy.c for pset1 to calculate coins and change remaining?

For greedy.c in pset1 I used a do...while to validate user input. But I couldn't see how to loop thru 25, 10, 5, 1 for quarters, dimes, nickels, pennies. I did the exact same calculation 3 times, ...
Mark Katzenberger's user avatar
0 votes
1 answer
1k views

Mario.c hashes pyramid

4 int main(void) 5 { 6 int height; 7 int rows; 8 int spaces; 9 int hash; 10 11 do 12 { 13 printf("For the height, Choose a number from 0 to 23?: "); 14 height = GetInt(); 15 } ...
vslateart's user avatar
0 votes
1 answer
234 views

Greedy; Pset 1 - Trouble creating modulo algorithm

int q=coins/25; //gives number of quarters int mq=coins%25; gives modulo quarters int md=mq/10; int mn=md/5; int mp=mn/1; printf("%d, %d, %d, %d,", q+md+mn+mp); So I've been able to prompt the user ...
Gooddb67's user avatar
0 votes
0 answers
76 views

Typing hashtag in gedit using a mac keyboard

I've already changed my keyboard layout to English (UK) as per these instructions (Configure appliance for QWERTY layout (UK)). Every key is now correctly assigned except for hashtag, which on my ...
Jack Davies's user avatar
0 votes
1 answer
342 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 ...
Sheila Sutton's user avatar
0 votes
1 answer
242 views

Problem with my mario's pyramid

I've spend half day reading the site for anything that could help me answer my doubts, but no success. After many tribulations I wrote down a code I thought would finally work but no such luck. It ...
Margherita Bigossi's user avatar
0 votes
1 answer
38 views

greedy can't get compiled- PSet 1

I finished writing the code to greedy and I went to compile it and this is the response that I got in the appliance: No rule to make target 'greedy' Please help! Thanks in advance Debbie
Debbie Rodriguez's user avatar
0 votes
1 answer
257 views

Greedy - Not getting right number of coins for 0.41

So my code looks like this: #include <cs50.h> #include <stdio.h> #include <math.h> int main(void) { // Get change printf("How much change is owed? "); float change = ...
Danielle R's user avatar
0 votes
1 answer
183 views

Why isn't my pset1 code working? I really need help

I don't really understand what I'm doing, and have been working on this for a long time.
daenadamonse's user avatar
0 votes
1 answer
141 views

GetInt() Can not read more than 10 Digits and proplems with zero!

Hello Guys I'm on the hacker edition on pset1 I just wants to get the number of digits that the users type but it doesn't want to read more than 10 digits ! and when typing zero as a first digit ...
A.ezzat's user avatar
0 votes
1 answer
151 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..
Abhishek Poonia's user avatar
0 votes
0 answers
175 views

How to link math.h using " make "? [duplicate]

In greedy , for using "round" function , I need the compiler to automatically include math.h every time ( without linking it every time )using make but not with gcc . Is it possible ? if so , How ? ...
Sai Charan Nivarthi's user avatar
0 votes
1 answer
382 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 ...
Mohammed Shayan Khan's user avatar
0 votes
1 answer
80 views

Where do I put the 'formula' for the hashes and spaces?

I put in everything I think should be included, but I can't figure out where to put the row + 2 that makes the hashes increment and the height-- that makes the spaces decrement. The end result is ...
Bill Carroll's user avatar