More Related Content
More from JAy YourJust'one (16)
เกมจับคู่3
- 1. เกมจับคู่
#include <iostream>
#include <string>
bool card_select(int &location, int who) {
if (location==0) {
location=who;
return true;
} else {
return false;
}
}
//map the integers representing the letters
string peice(int who) {
if (who=11)
return "A1";
else if (who=12)
return "A2";
else if (who=21)
return "B1";
else if (who=22)
return "B2";
else if (who=31)
return "C1";
else if (who=32)
return "C2";
else if (who=41)
return "D1";
else if (who=42)
return "D2";
else if (who=51)
return "E1";
else if (who=52)
return "E2";
else return " ";
}
void draw_board() {
cout << " " << peice(p1x1) << " | " << peice(p1x2) << " | " << peice(p1x3) << " |
" << peice(p1x4) << " | " << peice(p1x5) << " " << endl;
cout << "-----------------------" << endl;
- 2. cout << " " << peice(p2x1) << " | " << peice(p2x2) << " | " << peice(p2x3) << " |
" << peice(p2x4) << " | " << peice(p2x5) << " " << endl;
}
//determine if the cards match
int check(int p1, int p2) {
if (p1==p2)
return p1;
return 0;
}
bool draw() {
return ((p1x1!=0)&&(p1x2!=0)&&(p1x3!=0)&&(p1x4!=0)&&(p1x5!=0)&&
(p2x1!=0)&&(p2x2!=0)&&(p2x3!=0)&&(p2x4!=0)&&(p2x5!=0));
}
นางสาว นุจรี บุญชูเชิด ม 6/3 เลขที่
26