[cs13001] Example Midterm

Mikhail Nesterenko mikhail at cs.kent.edu
Tue Mar 4 10:23:22 EST 2014


>  I'm also having some issues with number 7.  It seems like it
> should be similar to the lottery lab that we just recently did, but I had a
> lot of problems with that assignment so could you just explain this
> question as well.
> 

Question seven is requires application of the iterate-and-keep-track
idiom. Here is one solution:

  bool found=false;
  for(int i=0; i<SIZE; ++i)
     if(number == myarray[i])
     	  found=true;

  if(found)
     cout << "FOUND";
  else
     cout << "NOT FOUND";


Thanks,
-- 
Mikhail


More information about the cs13001 mailing list