Thread: memory game
View Single Post
Join Date: Oct 2008
Posts: 11
Reputation: egolovin is an unknown quantity at this point 
Solved Threads: 0
egolovin egolovin is offline Offline
Newbie Poster

memory game

 
0
  #1
Nov 20th, 2008
Hi all i am working on a memory game and i am having problems inputing the data so it checks if a 3rd number is pulled up to ignore it
thanks in advance
  1. int card[6][6],total=0,value,test;
  2. srand((unsigned)time(NULL));//randomize timer
  3.  
  4. for (int i=0;i<6;i++)
  5. {
  6. for (int j=0;j<6;j++)
  7. {
  8. value=rand()%18;//random
  9. test=0;
  10. card[i][j]=value;//sets the value
  11. for (int x=0;x<6;x++)
  12. {
  13. for (int y=0;y<6;y++)//starts the check for doubles
  14. {
  15. if(value==card[x][y])
  16. {
  17. test++;
  18. cout<<i<<endl;
  19. }
  20. if (test==3)
  21. {
  22. //need a code to stop for the 3rd one to be put in.
  23. }
  24. }
  25. }
  26. }
  27. }
Reply With Quote