SlideShare a Scribd company logo
1 of 2
เกมจับคู่
#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;
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

More Related Content

More from JAy YourJust'one

งานย อยท _ 6 ต__งคำถาม java
งานย อยท _ 6 ต__งคำถาม javaงานย อยท _ 6 ต__งคำถาม java
งานย อยท _ 6 ต__งคำถาม java
JAy YourJust'one
 
ซัมซุงนัดต้นปีเปิดตัว
ซัมซุงนัดต้นปีเปิดตัวซัมซุงนัดต้นปีเปิดตัว
ซัมซุงนัดต้นปีเปิดตัว
JAy YourJust'one
 
เกมจับคู่5
เกมจับคู่5เกมจับคู่5
เกมจับคู่5
JAy YourJust'one
 
เกมจับคู่4
เกมจับคู่4เกมจับคู่4
เกมจับคู่4
JAy YourJust'one
 
เกมจับคู่4
เกมจับคู่4เกมจับคู่4
เกมจับคู่4
JAy YourJust'one
 
เกมจับคู่2
เกมจับคู่2เกมจับคู่2
เกมจับคู่2
JAy YourJust'one
 
แต่งกลอนภุชงคประยาตฉัน11
แต่งกลอนภุชงคประยาตฉัน11แต่งกลอนภุชงคประยาตฉัน11
แต่งกลอนภุชงคประยาตฉัน11
JAy YourJust'one
 
ฮาร์ดไดรฟ์ปลอม
ฮาร์ดไดรฟ์ปลอมฮาร์ดไดรฟ์ปลอม
ฮาร์ดไดรฟ์ปลอม
JAy YourJust'one
 
Samsung nc215 โน้ตบุ๊คพลังงานแสงอาทิตย์
Samsung nc215 โน้ตบุ๊คพลังงานแสงอาทิตย์Samsung nc215 โน้ตบุ๊คพลังงานแสงอาทิตย์
Samsung nc215 โน้ตบุ๊คพลังงานแสงอาทิตย์
JAy YourJust'one
 
การค้นหาข่าวสารในแวดวง I
การค้นหาข่าวสารในแวดวง Iการค้นหาข่าวสารในแวดวง I
การค้นหาข่าวสารในแวดวง I
JAy YourJust'one
 

More from JAy YourJust'one (16)

ย อย6
ย อย6ย อย6
ย อย6
 
งานย อยท _ 6 ต__งคำถาม java
งานย อยท _ 6 ต__งคำถาม javaงานย อยท _ 6 ต__งคำถาม java
งานย อยท _ 6 ต__งคำถาม java
 
Java
JavaJava
Java
 
It
ItIt
It
 
ซัมซุงนัดต้นปีเปิดตัว
ซัมซุงนัดต้นปีเปิดตัวซัมซุงนัดต้นปีเปิดตัว
ซัมซุงนัดต้นปีเปิดตัว
 
เกมจับคู่5
เกมจับคู่5เกมจับคู่5
เกมจับคู่5
 
เกมจับคู่4
เกมจับคู่4เกมจับคู่4
เกมจับคู่4
 
เกมจับคู่4
เกมจับคู่4เกมจับคู่4
เกมจับคู่4
 
เกมจับคู่2
เกมจับคู่2เกมจับคู่2
เกมจับคู่2
 
แต่งกลอนภุชงคประยาตฉัน11
แต่งกลอนภุชงคประยาตฉัน11แต่งกลอนภุชงคประยาตฉัน11
แต่งกลอนภุชงคประยาตฉัน11
 
3
33
3
 
2
22
2
 
ฮาร์ดไดรฟ์ปลอม
ฮาร์ดไดรฟ์ปลอมฮาร์ดไดรฟ์ปลอม
ฮาร์ดไดรฟ์ปลอม
 
Samsung nc215 โน้ตบุ๊คพลังงานแสงอาทิตย์
Samsung nc215 โน้ตบุ๊คพลังงานแสงอาทิตย์Samsung nc215 โน้ตบุ๊คพลังงานแสงอาทิตย์
Samsung nc215 โน้ตบุ๊คพลังงานแสงอาทิตย์
 
Fdf
FdfFdf
Fdf
 
การค้นหาข่าวสารในแวดวง I
การค้นหาข่าวสารในแวดวง Iการค้นหาข่าวสารในแวดวง I
การค้นหาข่าวสารในแวดวง I
 

เกมจับคู่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