#need help with c program that prints a food receipt and sum of prices.. im still new im sorry ):

22 messages · Page 1 of 1 (latest)

brazen jasperBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

topaz hull
#

this is the output ): it doesnt allow me to input anything after size

torpid gulch
#

scanf("%d", &dish_size) will not accept "m"

#

%d is for decimal numbers like 1 and 2

#

so scanf "%d" returns 0 to indicate that it failed

#

and it leaves the "m" for someone else to deal with

topaz hull
#

so %c ? ):

torpid gulch
#

the target variable needs to be a char

#

and the format needs to be " %c" with a space

topaz hull
#

THAT WORKEDD peepohappy peepohappy

#

but whats up with the prices output?

torpid gulch
#

you'ie trying to print a pointer

#

printf("%f", &thing) <- wrong, &thing is a pointer

#

instead
printf("%f", thing)

topaz hull
#

oh

torpid gulch
#

scanf takes pointers, printf doesn't

#

(unless you're actually trying to print a pointer, lol)

topaz hull
#

EEEEE URE SMART

topaz hull
#

!solved

brazen jasperBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity