Skip to main content
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
Results tagged with
Search options answers only not deleted user 12099
0 votes

cash.c I dunno which part is incorrect

Floating point cannot accurately represent values like 4.2. int conversion truncates the value (rounds towards zero), you might want to use round from math.h or something like that. You might have me …
Blauelf's user avatar
  • 21k
1 vote
Accepted

how to carry over value of int through while loops (cash/less)

You have changed to using cents, but quarter and so on are still in dollars. Variables like count, declared in the function, not globally, are not initialised by default, so start at any value (maybe …
Blauelf's user avatar
  • 21k
3 votes
Accepted

pset1 cash.c guidance

That single ; after your while is an empty statement, and in the code you show it is the loop's body. So your loop keeps doing nothing, and repeat that. Remove that extra semicolon. Semicola are meant …
Blauelf's user avatar
  • 21k
1 vote
Accepted

Why removing a printf function messes up with my code? CS50 pset1 cash greedy challenge

Could it be the missing line break? The output of printf("Your input: $ %.2f", a); printf(", which amounts to %i total.\n", cents); or equivalently printf("Your input: $ %.2f, which amounts to %i …
Blauelf's user avatar
  • 21k
1 vote
Accepted

PSet1 cash, modulo problem

Welcome to the world of (binary) floating point. A value like 4.2 cannot be precisely represented in binary, it would be represented by an infinite sequence of binary digits. Obviously we don't have a …
Blauelf's user avatar
  • 21k