Questions tagged [cash.c]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
118 views

make: *** No rule to make target 'cash'. Stop

I have this problem. I'm trying to run this program but it keeps showing me this message and it confuses me since I have the file cash.c saved in the pset1 directory and cash (folder). I've looked for ...
Valentina Rivas's user avatar
0 votes
1 answer
259 views

CS50 problem set 1 cash

#include <stdio.h> #include <math.h> #include <cs50.h> int main(void) { // Get float for cents // Take inputs of positive floats and repromt user for negative float ...
Nick's user avatar
  • 3
0 votes
1 answer
67 views

Code not working - cash

Can someone please help me, as far as I think this code should give back the number of coins needed but it is not working.
Saara Luthra's user avatar
0 votes
1 answer
36 views

"cash.c:7:1: error: expected identifier or '('" What do I do?

I've been trying to compile cash.c, but for a reason, it always says I have an error in line 7... could someone help me find the error...? I tried different things to try and make it work but it does'...
Mika-Anne Reha's user avatar
0 votes
1 answer
62 views

Coin count off by 1 in cash

When I input an amount into the program cash, it gives me one more coin than I should have and I'm not sure how to fix it #include <stdio.h> #include <cs50.h> #include <math.h> //...
Liz-Sod497's user avatar
0 votes
1 answer
40 views

CASH issue - help needed

I've been struggling with this for a month now so any help will be appreciated. The program just returns the value of input, so although there are no errors in compiling, it doesnt actually produce ...
Soya's user avatar
  • 5
1 vote
2 answers
25 views

cash (less) - ouput is not converting from dollars to cents or rounding

hi i'm trying to convert the users input from dollars to cents. every time it just prints exactly what i typed in, so if i enter 0.20, the output is 0.200000. my math.h seems to be having no effect ...
JFTrees's user avatar
  • 25
0 votes
1 answer
181 views

CS50 pset 1 cash problem: keep getting 1 as answer

I'm trying to do the CS50 cash problem and the answer keeps getting number 1 no matter which change I input. It won't accept negative numbers as asked by the problem, but I don't know why it doesn't ...
naju's user avatar
  • 3
0 votes
1 answer
207 views

cash CS50 2020 pset1 modulo

I seem to be having trouble using modulo as conditions inside of while loops. int main() { float n; do { n = get_float("How much change is owed? "); } while(n < 0); int cents = round(...
BadVariableName's user avatar
0 votes
1 answer
165 views

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

I finished the challenge and my first C code worked apparently well, returning each time the correct minimum number of coins needed for change. Then when I tried to "clean it up" a bit and remove a ...
Daniel Fernandez's user avatar
0 votes
1 answer
97 views

I need help. (pset 1 - cash) I don't get this!

So this is the code I have now: #include <stdio.h> #include <cs50.h> #include <math.h> int main (void) { float c; int i; do { c = get_float("Change: "); } while (c <...
Akhil Kumar's user avatar
0 votes
1 answer
59 views

I don't understand where I went wrong?

So this is the code I have right now for cash in problem set 1. I don't know whats wrong. #include <stdio.h> #include <cs50.h> #include <math.h> int maid (void) { float c; ...
Akhil Kumar's user avatar
0 votes
1 answer
58 views

Transform function into a loop or similar

So my problem is in problem set 1 of week 1 of the CS50 Harvard course. The task was writing a program that calculates the smallest amount of coins possible when getting change. I've already written ...
xbufu's user avatar
  • 107
0 votes
1 answer
143 views

PSet1 cash, modulo problem

Why does this give 19 instead of 20 when change = 4.2? Thanks.
user9891471's user avatar
0 votes
1 answer
681 views

pset1 cash.c check50 outputs 1 error?

I am receiving this output from check50 on pset1 cash.c :) cash exists :) cash compiles :) input of 0.41 yields output of 4 :) input of 0.01 yields output of 1 :) input of 0.15 yields output of 2 :) ...
JohnWick's user avatar
  • 155
0 votes
1 answer
261 views

pset1 cash.c Do While loop executing even when condition = false?

I am inputting 0.26 into cash.c, and after the first do while loop in my program, f = 0.00999999046 My second do while loop condition is f >= 0.10, yet it is executed even though f is less than that. ...
JohnWick's user avatar
  • 155
0 votes
1 answer
387 views

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

I am attempting the cash exercise (less comfortable) on pset1. I've created four different while loops to help count how many coins change there should be. I tried the program out with just the first ...
Daniel Hill's user avatar
0 votes
1 answer
178 views

cash.c I dunno which part is incorrect

I havent finished the whole, just the dollar part. But the formulation cannot be run correctly Can anyone tell me which part is incorrect?
Christy Ng's user avatar
2 votes
1 answer
10k views

pset1 cash.c guidance

I am stuck on pset1 cash problem. When I run my script I get a blank and it never completes the calculation. The best I've been able to display is 0 even though its the wrong answer. I figure I ...
SuperZumo's user avatar