SlideShare a Scribd company logo
1 of 2
เกมจับคู่
#include <iostream>
#include <string>
/if 1 - face up
//if 2 - face down
int winner() {
int result;
result=check(p1x1, p1x2);
if (result!=0) return result;
result=check(p1x1, p1x3);
if (result!=0) return result;
result=check(p1x1, p1x4);
if (result!=0) return result;
result=check(p1x1, p1x5);
if (result!=0) return result;

result=check(p1x1, p2x1);
if (result!=0) return result;
result=check(p1x1, p2x2);
if (result!=0) return result;
result=check(p1x1, p2x3);
if (result!=0) return result;
result=check(p1x1, p2x4);
if (result!=0) return result;
result=check(p1x1, p2x5);
if (result!=0) return result;
if (draw()) return 3;
return 0;
}
void play(int player) {
int row;
int col;
int win;
win=winner();
if (player==1) {
cout << "Enter row (1 or 2):" << endl;
cin >> row;
cout << "Enter column (1 to 5):" << endl;
cin >> col;

if (make_move(row, col, player)) {
draw_board();
play(1);
} else {
cout << "Invalid move, try again" << endl;
play(1);
}
}
}
int main() {
cout << "Welcome to the matching card game " << endl;
draw_board();
play(1);
return 0;
}               นางสาว มนัสนันต์ ทับทิมใส ม 6/3 เลขที่ 32

More Related Content

What's hot

What's hot (17)

Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)
 
งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์
 
C programs pbq final
C programs pbq finalC programs pbq final
C programs pbq final
 
JavaScript Quizz 2014
JavaScript Quizz   2014JavaScript Quizz   2014
JavaScript Quizz 2014
 
Cpp c++ 2
Cpp c++ 2Cpp c++ 2
Cpp c++ 2
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
SPL 10.1 | Manual Tracing on Basic Loop & 1D Array
SPL 10.1 | Manual Tracing on Basic Loop & 1D ArraySPL 10.1 | Manual Tracing on Basic Loop & 1D Array
SPL 10.1 | Manual Tracing on Basic Loop & 1D Array
 
C
CC
C
 
Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))
 
3. chapter ii
3. chapter ii3. chapter ii
3. chapter ii
 
4. chapter iii
4. chapter iii4. chapter iii
4. chapter iii
 
Matlab code for secant method
Matlab code for secant methodMatlab code for secant method
Matlab code for secant method
 
#2
#2#2
#2
 
C++ TUTORIAL 2
C++ TUTORIAL 2C++ TUTORIAL 2
C++ TUTORIAL 2
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
1 (1)
1 (1)1 (1)
1 (1)
 

Viewers also liked

Viewers also liked (7)

It news
It newsIt news
It news
 
Text2mindmap
Text2mindmapText2mindmap
Text2mindmap
 
Tecnologia en la educacion
Tecnologia en la educacionTecnologia en la educacion
Tecnologia en la educacion
 
ゲーム実況動画の作り方
ゲーム実況動画の作り方ゲーム実況動画の作り方
ゲーム実況動画の作り方
 
mi primera pagina web
mi primera pagina webmi primera pagina web
mi primera pagina web
 
souravnandiresume
souravnandiresumesouravnandiresume
souravnandiresume
 
Bobina de tesla
Bobina de teslaBobina de tesla
Bobina de tesla
 

More from JAy YourJust'one

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

More from JAy YourJust'one (17)

ย อย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
 
เกมจับคู่3
เกมจับคู่3เกมจับคู่3
เกมจับคู่3
 
เกมจับคู่2
เกมจับคู่2เกมจับคู่2
เกมจับคู่2
 
เกมจับคู่1
เกมจับคู่1เกมจับคู่1
เกมจับคู่1
 
แต่งกลอนภุชงคประยาตฉัน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
 

เกมจับคู่4

  • 1. เกมจับคู่ #include <iostream> #include <string> /if 1 - face up //if 2 - face down int winner() { int result; result=check(p1x1, p1x2); if (result!=0) return result; result=check(p1x1, p1x3); if (result!=0) return result; result=check(p1x1, p1x4); if (result!=0) return result; result=check(p1x1, p1x5); if (result!=0) return result; result=check(p1x1, p2x1); if (result!=0) return result; result=check(p1x1, p2x2); if (result!=0) return result; result=check(p1x1, p2x3); if (result!=0) return result; result=check(p1x1, p2x4); if (result!=0) return result; result=check(p1x1, p2x5); if (result!=0) return result; if (draw()) return 3; return 0; } void play(int player) { int row; int col; int win; win=winner(); if (player==1) { cout << "Enter row (1 or 2):" << endl; cin >> row; cout << "Enter column (1 to 5):" << endl; cin >> col; if (make_move(row, col, player)) { draw_board(); play(1); } else { cout << "Invalid move, try again" << endl; play(1); } } } int main() {
  • 2. cout << "Welcome to the matching card game " << endl; draw_board(); play(1); return 0; } นางสาว มนัสนันต์ ทับทิมใส ม 6/3 เลขที่ 32