Questions tagged [pset1]

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

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

Greedy - what's did I do wrong with round()?

http://paste.ubuntu.com/7827955/ At this stage, I want the program to get a dollar amount from the user, convert it to cents, and then (just for now to confirm it's been done right). Based on what I ...
0
votes
2answers
1k views

Need help with code for mario

I created a loop to print the required spaces and a loop to print the required hashes. The program works. However, checkcs50 doesn't like it. Here are checkcs50 statements: :( handles a height of 0 ...
1
vote
2answers
186 views

Where can I find comments on my projects

I have looked in my grade book and I received a 1 for pset0 and a .39 for pset1. Is a 1 the highest score you can get? I thought the psets were graded on a 1-5 scale? For the mario exercise I got a ...
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 ...
2
votes
1answer
129 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.
1
vote
2answers
366 views

if-else statements fails

My greedy program works absolutely correctly with positive numbers including 0. However, when I introduce if-else concept to check for negative numbers, into my program I receive an error message. ...
0
votes
2answers
634 views

Why Does greedy Fail Passing check50 Tests? [duplicate]

I completed the code and ran the program. I get the desired results, but when I run check I receive the following red lines: :( input of 0.41 yields output of 4 \ expected output, but not "Number ...
0
votes
1answer
193 views

Does greedy's Output Have to Match The One Required per the Pset Specification Page?

I'm trying to check my greedy program with check50. I'm wondering whether my output must match the one required per the pset specification page. Here's check50's output jharvard@appliance (~/Dropbox/...
0
votes
1answer
93 views

Why Am I Getting These Symbols Printed Out?

I'm working on mario trying to print hashes and spaces, but rather I get these symbols printed out instead . Why am I getting these symbols? I'm using statements like these within my program to ...
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
1answer
752 views

Why Does mario Not Pass check50 Tests?

Having issues passing check50's tests for mario. I looked at other issues, including ones that look the same as mine, but I haven't found a solution. My code seems to give the desired results as ...
0
votes
3answers
637 views

do while loop not working?

I used these condition in do while loop , and I still getting the forever loop. It just doesn't stop. while( x > 0 || x < 23);
0
votes
1answer
475 views

Can't submit pset1 assignment

I've completed the assignment for pset1. I have followed the directions for submitting the assignments. However, when I try to sign in to submit my assignments I get the following message, "You aren'...
0
votes
3answers
2k views

implicit declaration of function 'getint' is invalid in C99

I am getting an error as implicit declaration of function 'GetInt' is invalid in C99 when I, am using GetInt() in my program. Please can anybody help.
1
vote
2answers
122 views

Why “make” doesn't throw error when I include some libraries like “string.h”?

Why doesn't make throw an error when I include some libraries like string.h? make uses options such as -lcs50 and -lm to link the object files for header file cs50.h and math.h. For example, the ...
0
votes
2answers
2k views

pset1 error: expected 'while' in do/while loop [duplicate]

I am getting a strange error. What does it mean? I moved stuff around and changed stuff but it won't stop. #include <stdio.h> #include <cs50.h> int main(void) { int num; { ...
1
vote
1answer
23k views

C syntax errors like “expected expression”

I completed an introduction to programming using Python and I am more used to Python then C, so I might mix the two up. C is giving me all kinds of errors. I tried changing things but noting seems to ...
0
votes
2answers
504 views

“Killed by server” at the check50 test: rejects negative input like -.1

When I upload my program to check50, everything is green except I get this one error: :( rejects a negative input like -.1 \ killed by server What do I need to do to fix this?
0
votes
2answers
203 views

Can't find the saved file

In pset1 , following the instructions I wrote the hello.c file and saved it in the pset1 directory under Dropbox but when I go to the directory , I can't find the saved file. It also doesn't list when ...
1
vote
1answer
556 views

where is the Debugger in Gedit for C

I have been having some trouble writing my programs. I have been trying to find the debugger for c to speed up the process, but I have not succeeded. If you have found it can you please tell me where ...
0
votes
5answers
406 views

Errors Running mario

A few days ago, this program ran correctly, but now it's showing errors. I tried to find the problem, but I don't understand what these error message mean. What am I doing wrong? jharvard@appliance (~...
0
votes
1answer
137 views

Compilation Errors When Compiling greedy

For some reason, even though I have declared the float variable change in my greedy.c program, the Clang compiler gives an error message saying that I have not declared it. Even with 3 compiler ...
0
votes
1answer
134 views

Pyramid problem compiling errors

I am getting two compiler errors. What do these errors mean and how can I eliminate them? jharvard@appliance (~/Dropbox/pset1): make mario clang -ggdb3 -O0 -std=c99 -Wall -Werror mario.c -lcs50 -...
0
votes
2answers
204 views

Compiler Errors in greedy.c

I see the following three Clang compiler errors when I run greedy.c: jharvard@appliance (~/Dropbox/pset1): make greedy clang -ggdb3 -O0 -std=c99 -Wall -Werror greedy.c -lcs50 -lm -o greedy greedy....
0
votes
1answer
522 views

greedy.c program compiler errors

I am a novice regarding compilers. Can somebody explain to me what the following printed errors mean? Since I was not sure whether I will be violating the Honor Code, I have not included my greedy.c ...
0
votes
2answers
861 views

Compiler errors while using Clang [duplicate]

I have been using Clang Compiler and check50 to write the programs in pset1 i.e hello.c and greedy.c I have found that check50 appears to say that hello.c and greedy.c compile ,even though the Clang ...
0
votes
3answers
366 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
130 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 ...
1
vote
2answers
150 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
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 ...
1
vote
2answers
936 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
908 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
699 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
345 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
909 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
103 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
346 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
440 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 ...
0
votes
2answers
23k 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
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?
0
votes
1answer
2k 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
198 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) ...