Edited by Supernature, 28 July 2010 - 06:05 PM.
Sequential Searching with Arrays - C++
Started by Supernature, Jul 28 2010 04:51 PM
4 replies to this topic
#1
Posted 28 July 2010 - 04:51 PM
#2
Posted 28 July 2010 - 06:09 PM
15 year old here, dont blame me if I get something wrong.
Everything looks fine until your last do-while loop.
Your logic is wrong there
So you 'get' the item name right?
Then you put it into the last slot of the array, which is weird. Try to make it a char or float?
Then after that, you want to make a loop of some sort to try and match it up with your array with items.
If it matches up, then take the number and cout both the item and calories.
If it doesnt, say so.
Get it? O___O
Oh and also, if you make declare the array with 100 slots, it only goes from 0-99 and you skip 0, so your array only has 99 slots.
Ops nvm.
I LIKE REP D;
Everything looks fine until your last do-while loop.
Your logic is wrong there
So you 'get' the item name right?
Then you put it into the last slot of the array, which is weird. Try to make it a char or float?
Then after that, you want to make a loop of some sort to try and match it up with your array with items.
If it matches up, then take the number and cout both the item and calories.
If it doesnt, say so.
Get it? O___O
Ops nvm.
I LIKE REP D;
Edited by Junsu, 28 July 2010 - 06:05 PM.
#3
Posted 28 July 2010 - 06:10 PM
Thanks Junsu :*
#4
Posted 28 July 2010 - 06:11 PM
Nps. I'll try to help anytime ^___^
#5
Posted 28 July 2010 - 06:25 PM
Here's a possible bug you might have.
Don't loop through all 100 items when searching. Remember that 100 items is the max # of products that can be inputted, not the # of products that is inputted.
Don't loop through all 100 items when searching. Remember that 100 items is the max # of products that can be inputted, not the # of products that is inputted.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users