[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Programming advice

You are currently reading a thread in /g/ - Technology

Thread replies: 9
Thread images: 1
File: custbal.png (51 KB, 1313x764) Image search: [Google]
custbal.png
51 KB, 1313x764
Hey, so i'm working on studying arrays and i tried to set up this little program to run, and it works fine but when i enter a value that returns over 100 and it should print the customer's balance, it instead just prints $0.00, and i don't know why, could anyone help with this?
>>
no one? my one source of hope has failed </3
>>
>>>/g/dpt
try there, from a quick look it seems fine
>>
>>51868155
you should have linked to a hastebin of the source so I don't have to retype half of your program
>>
you're trying to print a float but your balances are integers
>>
Going to bed now.

Issue is types.

> int custBal
You need float. And force all nums to float i.e.
float custBal[] = {0.00f, 45.43f .. etc)

> if custBal[cnt] > 100.0
Should be > 100.0f
>>
>>51868494
ah i was looking for your problem but i didn't see this part
>but when i enter a value that
>returns over 100
>>
Floats!=integers
>>
>>51868632
meant to say it's probably this
>>51868494
>>51868535
this
Thread replies: 9
Thread images: 1

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK