Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-10-2013, 06:21 PM   #1
BSOD
 
Join Date: Feb 2013
Location: Parallel Universe
Posts: 313
Default Is there a Bug in my code?

I am having trouble with my BYOB program I think there is a bug in it:

When i want one fish or chips or hot dogs I get charged for two.

It should ask what you want, how much and charge you in the right way.

It seems to times two what no matter what number of fish I want.

Could someone help, I can send you the .ypr file.
Attached Images
File Type: jpg Untitled.jpg (94.8 KB, 9 views)
__________________

XPikachu is offline   Reply With Quote
Old 03-10-2013, 08:33 PM   #2
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: Is there a Bug in my code?

I would imagine that the block which says "Change Fish by Fish * Answer" (and the other similar ones) are adding Fish * Answer to the original value of Fish, meaning you would end up getting charged for one extra.

You probably don't want to use the same variables for storing the price of fish, chips etc. and setting the value of the fish, chips, etc. that have been bought - that's where I'd say you're going wrong.

Oh, and I'm not usually a language-police person, but the language in the question in that screenshot is a bit strong for posting here really...
__________________

__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 03-10-2013, 08:52 PM   #3
BSOD
 
Join Date: Feb 2013
Location: Parallel Universe
Posts: 313
Default Re: Is there a Bug in my code?

Quote:
Originally Posted by berry120 View Post

You probably don't want to use the same variables for storing the price of fish, chips etc. and setting the value of the fish, chips, etc. that have been bought - that's where I'd say you're going wrong.
Im new to BYOB and I honestly don't know how to fix it.

Yeah I should have changed the lang in it before I posted it

Here is my taxi one and it works, same with my bank one.
Attached Images
File Type: jpg Untitled.jpg (94.5 KB, 6 views)
File Type: jpg Unt3itled.jpg (97.0 KB, 4 views)
XPikachu is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 04:51 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0