Questions tagged [pset1]

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

Filter by
Sorted by
Tagged with
0
votes
3answers
370 views

Output on Mario

I am not sure how to get the code working the way I want. I think it should make sense. Should I change my approach on the output section to do...while? int height, space, hash; do { ...
0
votes
2answers
132 views

Problemset 1-setting up pset1 directorory in dropbox-clarification of my earlier question

0 votes 0 answers 2 views Problemset 1-setting up pset1 directorory in dropbox Problemset 1-setting up pset1 directorory in dropbox When I double clicked icon Home above Appliance 50-19 vmware ...
0
votes
2answers
158 views

Problemset 1-setting up pset1 directorory in dropbox

Problemset 1-setting up pset1 directorory in dropbox When I downloaded Appliance 50-19 version and double clicked on the icon Home nothing happens. Hence I am not able to set up the directory pset1 ...
2
votes
3answers
812 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 ...
1
vote
2answers
939 views

Problems with int, float, and for loops in greedy

I am having a hard time with greedy. I think this first part is OK; I already checked it with check50. But in this second part I think I was kind of guessing. I put the first two lines just to show ...
1
vote
2answers
912 views

How to Handle the Height of 0 Correctly?

I've completed the mario program and it works fine! When I re-checked the pset specification page, I found that I should accept non-negative integer no greater than 23. So I edited my code to ...
0
votes
3answers
178 views

Why Doesn't greedy Work After Asking for Change?

I thought I had finished Greedy but the program won't run beyond the initial request for change. Can't for the life of me see where the error is. #include <stdio.h> #include <cs50.h> #...
1
vote
1answer
1k views

How to Pass "expected an exit code of 0"?

When testing my greedy with check50, I keep getting this error: \ expected an exit code of 0, not standard error of "greedy.c:9:5: warning: ignoring return ..." Here's my code #include <cs50.h&...
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 ...
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 ...
0
votes
2answers
896 views

How Does sizeof() Work?

let suppose I have int coin[5] = {25, 10, 5, 1, 3}; printf("%i\n", sizeof(coin)); Please, I am not understanding why this is giving me an output of 20 I am still doing pset1 for the greedy ...
0
votes
2answers
476 views

Why am i not able use iostream and stdio which are header files for c++ in gedit?

I am unable to use iostream.h and conio.h in gedit as it states that these files are not found. what should i do?
0
votes
2answers
1k views

no such file or directory

I am trying to begin pset 1. I followed the instructions in the pset. After saving the file hello.txt, i execute the commands to open the file in the terminal by typing cd dropbox/pset1. I get the ...
1
vote
4answers
115 views

Can I write an "if" statement without an associated code block?

Is this valid code? if (0 <= tower_height <= 23); If so, how will it be executed?
0
votes
2answers
349 views

Why does greedy return the wrong output for 0.53 while other inputs work properly?

The change calculating program I wrote seems to be working as intended except when the input is .53 it returns 2 quarters and 2 pennies instead of 2 quarters and 3 pennies. It appears to be working ...
0
votes
2answers
2k views

How to build the pyramid in pset 1?

I'm stuck on the mario problem in pset1! How should I start going about printing the half pyramid? I already figured the user input part...
3
votes
1answer
492 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 ...
1
vote
2answers
36k views

How to Fix the "expression result unused" Error?

I am getting an error message of "expression result unused" for all of my while loops when I try to run the user input through my greedy algorithm. Any thoughts?
2
votes
2answers
234 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?
0
votes
1answer
3k views

How to solve "error: expected expression" on greedy.c

I'm working on greedy.c and everything is fine with my program, but this error doesn't allow me to continue: **greedy.c:39:6: error: expected expression else ^ 1 error generated.** Maybe I ...
1
vote
3answers
1k views

Can't run the staff implementation

i can't run the staff implementation for any problem set, i always get the same error, it's always something like : bash: ~cs50/pset4/breakout: No such file or directory
0
votes
1answer
199 views

Pset1 Greedy: how to get result of how many coins

For Greedy in Pset1 I have everything right except I have no idea how to track how many times a loop is run so it gives me how many coins I need. Or maybe there's another way to get the solution? It ...
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. ...
0
votes
3answers
3k views

How can I add alternate digits in credit.c?

I am currently trying to solve the hacker version of pset 1 (credit.c). I have successfully completed the rest of the psets (hacker and standard versions). I need to sum up the even (starting from 0) ...
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 ...
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)
0
votes
1answer
174 views

Reject empty/blank user input

For pset1 I want to reject an empty user input, so that when the user presses 'enter', either the Mario code runs or it gives the user an error message. Pseudo code: printf ('message to input 1-23'...
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 ...
3
votes
2answers
232 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 ...
0
votes
1answer
431 views

Why Do I Get Errors When Checking greedy with check50?

I recently finished my greedy program and checked it out using different values and it appears to work except for large numbers (more than 6 digits) because of the float problem. So, I checked it ...
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 ...
0
votes
3answers
686 views

Mario Pyramid - Check50 - Unexpected end of input

Does anyone know what this means? I'm getting the correct output from my program and this is the only message I get from check50.

1
19 20 21 22
23