Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
The problem set for Week 1 introduces the C programming language.
0
votes
Accepted
Why does rounding cents in greedy always give the inputted float as integer?
round( ) function in C returns the nearest integer value of the float/double/long double argument passed to this function.
If decimal value is from ”.1 to .5″, it returns integer value less than the a …
1
vote
pset1water question, does not compile
If you use the GetInt () function you must include the header file cs50.h
0
votes
Accepted
pset1 greedy.c no answer
change *= 100;
......
while (change >= 25)
{
count++;
amount-= 25;
}
in your while loop, change always worth the same whereas inside, amount decreases, so your while loop n …
1
vote
Accepted
Pset1 Mario lesser expected identifier or "("
int main(void);
You must eliminate the semicolon (;) that is the whole problem with your error
0
votes
Getting a chek50 error of not handling 0 correctly
while (height < 1 || height >23);
Is the statement that is causing problems the right thing is:
while (height < 0 || height >23);
According to the specifications
1
vote
incompatible pointer to integer conversion initializing 'int'
int n= get_int;
I suppose you want:
int n = get_int();
0
votes
Pset1 cash.c Can't seem to wrap my head around it
for (int coins = 0; i < 0.25, coins++)
Instead of a comma in the for loop we must put a semicolon. Regarding your error, it is a good warning from the compiler, the expression i <0.25 is never fulfi …
0
votes
Accepted
Error Code - Use of undeclared identifier in PSET 1, Mario
All errors are that you end each for loop with a semicolon, delete it.
By the way the screenshots are not very useful, if it were necessary to reproduce your errors, no one is going to recopy your cod …
1
vote
Accepted
How to solve this cs50 grading issue?
according to my experience it takes a maximum of 2 weeks to get your pset submission graded. usually it is graded much faster. If you've been waiting for more than 2 weeks though,if you continue to ha …
1
vote
Accepted
Trouble with first row of Mario.c
you have all the work done, but in your code, you have the variable hashes uninitialized
for (spaces = 0; spaces <height - hashes; spaces ++)
after an innermost loop hashes is initialized to zero, …
1
vote
Accepted
What's wrong in my greedy code?
your problem is rounding, greedy can work, sometimes without using rounding, but checking 0.41, is not a random choice, be sure to follow the specifications and you must use the function round ()
n = …
1
vote
I'm stressed, someone pls help
your problem is rounding, greedy can work, sometimes without using rounding, be sure to follow the specifications and you must use the function round ()
int cents = round(change*100)
0
votes
Organizing do while
In general your idea is correct, but you have not considered a DO-WHILE loop is executed at least once,this form afterq (for example) is initialized incorrectly, it is more appropriate to use a WHILE …
1
vote
Accepted
Pset 1-Do While Loop Not Working
while (Height < 0 || Height > 23);
I think this is really what you want
0
votes
Accepted
Check50 Issues When Debugging
It seems that your program does not have a proper output, at least not that check50 expected, it would be very useful that you will provide what your output or your entire program.
EDIT
Two serious …