Questions tagged [cash]

Cash problem in pset1

Filter by
Sorted by
Tagged with
0
votes
2answers
23 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 ...
0
votes
1answer
19 views

Buy Finance Pset9 Cash not working

I am working on pset9 finance and I have been stuck for a while on it, especially this part: cash = db.execute("SELECT cash FROM users WHERE user_id = :userid", userid= ...
1
vote
1answer
16 views

error: function definition is not allowed here( help!)

Not sure what the issue is, ive gotten this in all programs ive written with a function Would appreciate help Error message: cash.c:33:5: error: function definition is not allowed here #include <...
0
votes
1answer
132 views

variable used in loop condition not modified in loop body

i'm having some trouble here, not even sure if my loop is correct but i'm also confused as to why I got this error about the why the cents variable can not be modified, if anyone can explain to me ...
0
votes
1answer
23 views

Imprecision during float subtraction in python

During pset6/cash, I tried to write the python code without multiplying change by 100 to get cents (as I had in c). I had assumed that this wouldn't lead to any precision issues, however when ...
0
votes
1answer
22 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 ...
0
votes
1answer
22 views

Pset1 “cash” question

this is my first question here so sorry if I do it wrong. My code compiles (it´s not finished yet), and it prompts, but when I run ./cash and type a number, It always gives me 0 coins, no matter what ...
0
votes
1answer
31 views

How to solve use of undeclared identifier error

In Cash of Problem Set 1, I'm quite sure that I've declared the variables used in the code, but I keep getting the error : error: use of undeclared identifier 'q' int coins = (q + d + n + p) ; I ...
0
votes
1answer
39 views

Problem set 1, Cash executuion issue

My code is as following: #include <stdio.h> #include <cs50.h> #include <math.h> int main(void) { //prompt for change float a = 0; int c = 0; ...
0
votes
1answer
38 views

Cash Program not returning correct value for .41

I'm working on the Cash program in Week 2 and I think I have it all finished up the only problem is when I run check50 I get everything right except for .41 instead of returning 4 coins it gives an ...
0
votes
1answer
32 views

Problem probably related to floating numbers from CS50 pset1 cash

how you doing? I can't figure out where is the bug from my code :/ It's really strange and the results are not the same if you do the same test with "0.01", for instance... #include <...
0
votes
1answer
25 views

PSET1 Cash Outputting negative number?

I have a very bizarre problem I am experiencing. When I input any number the output by my program is as such: coins: 2 mQ + mD + mN + pN = -1055516176 When I run the program again it outputs nothing ...
0
votes
0answers
21 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
36 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
36 views

Can you tell me my mistake

Please help, I don't know where the problem is.
0
votes
1answer
45 views

Can you tell me my mistake? ;)

Could anybody tell me what my mistakes are ? #include <stdio.h> #include <math.h> int main (void) { float dollar; do { dollar=get_float("Enter your ...
0
votes
0answers
25 views

Could anyone explain the error message?

#include <cs50.h> #include <stdio.h> #include <math.h> int main (void) { float dollar; do { dollar = get_float("Enter your change"); } while (...
0
votes
1answer
32 views

Im having a real hard time

I have a cash directory in which my source code cash.c and machine code cash are within. Why does this pop up? $ cd workspace $ cd cash.c $ make cash clang -fsanitize=signed-integer-overflow -...
0
votes
2answers
33 views

Hello everybody : ) Can you help me out?

$ clang cash.c /tmp/cash-94cd4e.o: In function main': cash.c:(.text+0x1c): undefined reference to get_float' cash.c:(.text+0x44): undefined reference to `round' clang: error: linker command failed ...
0
votes
2answers
43 views

pset1 cash THESE 2 ERRORS DROVE ME WILD help a newbie out, I will send you good vibes in return

error: expected identifier or '(' error: expected ';' after top level declarator int main (void) code #include <cs50.h> #include <stdio.h> #include <math.h> int main(void) float ...
0
votes
1answer
11 views

Why do I get this “expected expression” error?

Like mentioned in the title, I get this "expected expression" error when I try to convert my amount from float into int type. Am I doing the conversion wrong ? Or is there something else I'm ...
0
votes
2answers
34 views

Cash 50 - Less Comfortable. Trying to nest so the algorithm will consider all money levels. Not working

coder newbie here. As far as I understand, this should work. This is the logic of my code... I get the float input from the user, and keep asking until I receive a positive number. I change this into ...
1
vote
1answer
25 views

I can't figure this out can anyone help PLEASE ( line 7 error) cash.c:7:1: error: expected identifier or '(' {

#include <stdio.h> #include <cs50.h> #include <math.h> int main (void); { float dollar; do; { dollar = get_float ("Where is my change: "); } ...
0
votes
1answer
45 views

CS50 Newbie needs help! Pset 1 cash problem. It compiles and runs but answers are wrong :(

Please check the code below. It runs fine but with a few "errors". when I input 0.41 as per the problem example, it gives me 16 coin count instead of 4. What is missing? Please help me ...
0
votes
1answer
25 views

Cash program only outputs input*4

I'm very new to coding and am really struggling with pset1- cash. I watched some tutorials and walkthrough videos, and with my limited knowledge, I cannot find any issue in the code I made. With the ...
0
votes
2answers
102 views

pset1 cash less, problem using for loops

I tried to use for loops to solve the cash (less) problem set, not sure if thats possible. Can this code be fixed or do I need to use while loops instead? the code compiles, but the output is either (...
0
votes
1answer
63 views

Having trouble with Cash but does not know what is wrong

I am having trouble with my code for pset1/cash. When I check the code, this is my output: :) cash.c exists :) cash.c compiles :( input of 0.41 yields output of 4' expected "4\n", not "...
1
vote
1answer
109 views

HELP, keep getting this error… error: invalid operands to binary expression ('float' and 'int')

Hi! keep getting this error in my code Could someone kindly help me figuring out whats wrong? Thank you :)
0
votes
1answer
32 views

NEED HELP WITH CASH (updated)

What is wrong with my code? I have spent a long time trying to figure it out but I cannot any help would be appreciated. I just updated it.
0
votes
1answer
67 views

Pset1 Cash less comfortable - not running for 0.41 and 0.01

-- hi im running into a problem with my code. It's executed pretty well with many inputs except for 0.41 and 0.01. It didn't print out any answer but just ran indefinitely... #include <stdio.h> #...
0
votes
2answers
93 views

pset 1 - cash problem - No errors, am rounding, but still not always correct amount of coins

I'm having trouble finding out where the problem with my code is on the Cash problem in the CS50 problem set 1. In the other questions for this problem on this forum it often seems to be the round() ...
0
votes
1answer
24 views

Why doesn't my code give me an output?

So I am very new to CS and I have been working hard twisting this code around in my mind trying to figure out why nothing happens when I run the program. It compiles fine, but whenever I put in any ...
0
votes
1answer
50 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
64 views

PSET1 Cash - less comfortable - errors only for 0.41, 0.15

I hope you can help me with the PSET1 task - cash - less comfortable. Here is my code but I cannot figure out why - when testing the code - only 0.41 and 0.15 deliver wrong outputs (8 instead of 4 and ...
0
votes
1answer
19 views

My program doesn't run when i close the condition's range. When i leave the range open it does't give the answer i want

#include <cs50.h> #include <stdio.h> #include <math.h> int main(void) { float change; int cents = 0, coin_number = 0, quart = 25, dime = 10, nickel = 5, penny = 1; //...
0
votes
1answer
54 views

This is my code for cash

This is my code for cash idk what I did wrong cuz when I compile it, it gives me a decimal of the number I put in instead of a whole number representing how many coins. Idk what I did wrong. #include &...
0
votes
1answer
113 views

cash less comfortable

I've been working on my cash problem but it keeps giving me error on the code especially the variables and I don't know why.
1
vote
1answer
31 views

Output Problem on CS50's Cash

so I used check50 on my code and it said 1.6, 23, and 4.2 had a wrong output. Can you please help me to see what I am doing wrong? Here is my code: #include <cs50.h> #include <stdio.h> #...
0
votes
1answer
37 views

Improvement in Cash Code

im curently doing pset4, but redoing the psets one by one for practice since I feel like im not yet ready to make pset4. Just finished pset2, Cash. The code is right and works, i was just wondering if ...
0
votes
2answers
93 views

Incorrect output by check50

I worked very hard on Cash and finally produced compilable code and correct output. But when I ran check50 I got these results, shown here. Please help. My code is shown below, in case you need it. #...
0
votes
0answers
552 views

Error: more '%' conversions than data arguments

#include <cs50.h> #include<math.h> #include<stdio.h> int main(void) { int n = 0; do { n = (get_float("Change owed: ") * 100); } while (n < 0); int ...
0
votes
1answer
122 views

Cash.c:11:24: error: expected expression

#include <cs50.h> #include<math.h> int main(void) { int n = 0; do { n = (get_float("Change owed: ") * 100); } while (n < 0); int q = ((n / 25) %) ...
0
votes
2answers
227 views

Error: Use of undeclared identifier in cash.c

#include <cs50.h> #include<math.h> int main(void) { do { int f = round(get_float("Change owed: ") * 100); } while (f < 0) q = ((f / 25)%) ...
0
votes
2answers
59 views

PSET 1 Cash two inputs don't get appropriate value

I'm stuck trying to understand what's wrong with my code... When I check it I get this error message: :( input of 1.6 yields output of 7 expected exit code 0, not 1 But getting 7 coins for 1.6$ ...
0
votes
1answer
133 views

Pset1 Cash - Incorrect number of coins

I've put together a solution to the problem set Cash using division. When I run the program, it returns incorrect number of coins for most of the cases, e.g. change 61 - 244 coins, change 0.80 - 14 ...
0
votes
1answer
56 views

Beginner with Cash code problem

Can you please look at my code and tell me if I am close or where to go to get help. I get an error at the G in this line. change= get_positive_float("Change owed: \n"); include include include ...
0
votes
1answer
67 views

problem set 1 _ cash

The problem is that it works for some values and not for others even though the float value is rounded. pls help { float change; do { change = get_float("change: "); } while (...
0
votes
1answer
72 views

pset1 Cash question

For some reason sometimes it gets the answers right and others it gets the answer wrong, I'm stuck so I don't know what to do next. #include <stdio.h> #include <cs50.h> #include <math....
0
votes
0answers
42 views

pset1 Cash, keeps answering 1

#include <cs50.h> #include <stdio.h> #include <math.h> int main(void) { float change; int coins = 0; do { change = get_float("Change owed: "); } ...
0
votes
1answer
45 views

i am working on problem set1 Cash. “else if” is not working

everything is working fine until the condition of remainder <= 5 is met (else if) then it just executes the first part only (if). #include <stdio.h> #include <math.h> #include <cs50....