Questions tagged [cash.c]
The cash.c tag has no usage guidance.
18
questions
0
votes
0answers
20 views
Help, doe not working - cash [duplicate]
Can someone please help me, as much as I think it should give the least amount of coins needed but it is not.
0
votes
1answer
34 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.
0
votes
1answer
22 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'...
0
votes
1answer
49 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>
//...
0
votes
1answer
30 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 ...
1
vote
2answers
14 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 ...
0
votes
1answer
131 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 ...
0
votes
1answer
112 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(...
0
votes
1answer
76 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 ...
0
votes
1answer
93 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 <...
0
votes
1answer
56 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;
...
0
votes
1answer
32 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 ...
0
votes
1answer
132 views
0
votes
2answers
575 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
:) ...
0
votes
1answer
216 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. ...
0
votes
1answer
311 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 ...
0
votes
1answer
148 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?
1
vote
1answer
9k 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 ...