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 |
2
votes
Accepted
cs50 Problem Set 1: Greedy. float 0.01 problem
Most of the problem is that no matter what you do, you keep putting the result back into change, a float. Floats have this nasty little problem that they don't store fractional parts of a number, the …
2
votes
Accepted
CS50 problem set 1 cash
Try printing out the value of cents after each calculation and think about the effect of integer division vs. regular division.
Does the code track BOTH the number of coins for each denomination AND t …
1
vote
Accepted
Nothing prints in Mario Problem
You have set up the while condition incorrectly.
Your do/while loop is this:
do
{
...
} while (h>=1 || h<=8);
You have essentially created an infinite loop. Think about the test condition. It …
1
vote
Accepted
problem set cash: why am I getting really high numbers in my return?
It looks to me like it's stuck in an infinite loop. Let's look at one of your functions.
int calculate_quarters(int cents)
{
int quarters;
while (cents >= 25)
{
quarters = (cents / …
1
vote
Accepted
What's marking procedure?
I can't speak with total authority, but you should get partial credit if it passes some of the check50 tests. It's not an all-or-nothing deal. Also, you can always try it. If you don't have a score …
0
votes
Accepted
Cash Program not returning correct value for .41
Have you tried printing out the value stored in cents before calculating the number of coins? Perhaps print out the value in dollar to 32 decimal places?
The problem lies here:
int cents = dollar * 1 …
0
votes
Accepted
Problem set 1 Mario variable issue
It's a scope issue. The variable "h" is created inside the curly braces, so it ceases to exist after the closing brace, where it is tested. In other words, h only exists between the curly braces on li …