PSOBB Eden
http://forum.edenserv.net/

coding help?
http://forum.edenserv.net/viewtopic.php?f=10&t=1882
Page 1 of 1

Author:  __O_daniel_O__ [ Fri May 06, 2011 11:48 pm ]
Post subject:  coding help?

I have this code that builds correctly...what I can't figure out to the life of me is that when it comes to this loop it keeps giving me an out of range error...I'd appreciate if anyone could help. -.-

Code:
cout << "Pick a number." << endl;
cin >> choice;
bool numberWasFound = false;

int j;

for (j = 0; sortedCollection.size(); j++)
{
   if(sortedCollection[j] == choice)
   {
      numberWasFound = true;
   }      
}   
   
if(numberWasFound == true)
{
   cout << "At index: " << j << endl;
}
else if (numberWasFound == false)
{
   cout << "Not found" << endl;
}

Author:  __O_daniel_O__ [ Sat May 07, 2011 12:31 am ]
Post subject:  Re: coding help?

Erm...I found it and feel like a complete idiot for not noticing it...-.-

Sorry for double posting...

Author:  Mayuru [ Sat May 07, 2011 10:08 pm ]
Post subject:  Re: coding help?

And less than an hour afterwards, too! XD

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/