• Advertisement
Sign in to follow this  

Memory game

This topic is 4369 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys! Do any one has the memory game who can share?? I made it on actionscript but I want to see it on C++ ;) Thank you guys!

Share this post

Link to post
Share on other sites
I so far have this:

#include <iostream>
#include <cstdlib>
#include <cstdio>

typedef struct {
int number;

using namespace std;

int main() {
const int NUM_MAX=10;
char panel1[NUM_MAX]={'I','I','I','I','I','I','I','I','I','I'};
char panel2[NUM_MAX]={'I','I','I','I','I','I','I','I','I','I'};
int card1, card2;
id one;
one.number = 1;
id two;
two.number = 2;
id three;
three.number = 3;
id four;
four.number = 4;
id five;
five.number = 5;
panel1[0] = one.number;
panel1[1] = two.number;
panel1[2] = three.number;
panel1[3] = four.number;
panel1[4] = five.number;
panel1[5] = one.number;
panel1[6] = two.number;
panel1[7] = three.number;
panel1[8] = four.number;
panel1[9] = five.number;

for (int i=0; i<NUM_MAX; ++i) {
cout<<panel2<<" ";


for (int i=0; i<NUM_MAX; ++i) {
cout<<i+1<<" ";


cout<<"\n\nFirst card, which number you wish to see?: ";
cout<<"Card: "<<panel1[card1-1];
cout<<"\n\nSecond card, which number you wish to see?: ";
cout<<"Card: "<<panel1[card2-1];

if (panel1[card1-1] == panel1[card2-1]) {
cout<<"\nGREAT, next\n";
panel2[card1-1] = panel2[card2-1] = 'O';

else {
cout<<"\n\nTry again";

for (int i=0; i<NUM_MAX; ++i) {
cout<<panel2<<" ";


return 0;

Almost done, but now how do I do a loop?

thank you ;)

[Edited by - yayo_99 on April 5, 2006 9:57:11 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement