-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFour.cpp
More file actions
69 lines (63 loc) · 1.19 KB
/
Four.cpp
File metadata and controls
69 lines (63 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <vector>
#include <iostream>
#include "Card.h"
#include "Four.h"
using namespace std;
Four::Four(Card &a,Card &b,Card &c,Card &d)
{
if((a.getface()==b.getface())&&(b.getface()==c.getface())&&(c.getface()==d.getface()))
{
f[0]=&a;
f[1]=&b;
f[2]=&c;
f[3]=&d;
}
else
cout<<"this four"<<a.toString()<<","<<b.toString()<<","<<c.toString()<<","<<d.toString()<<"is not a four!\n";
int m=55;
for(int i=0;i<3;i++)
{
if(f[i]->value<m)
{
m=f[i]->value;
minCard=f[i];
}
}
int n=0;
for(int i=0;i<3;i++)
{
if(f[i]->value>n)
{
n=f[i]->value;
maxCard=f[i];
}
}
}
Four::Four()
{
Card a,b,c,d;
f[0]=&a;
f[1]=&b;
f[2]=&c;
f[3]=&d;
}
string Four::toString()
{
return f[0]->toString()+" & "+f[1]->toString()+" & "+f[2]->toString()+" & "+f[3]->toString()+"___";
}
int Four::CompareFour(Four A,Four B)
{
if((A.maxCard)>(B.maxCard))
return 1;
else if((A.maxCard)<(B.maxCard))
return 0;
else
return -1;
}
void Four::swap(Four& a,Four& b)
{
Four tmp;
tmp=a;
a=b;
b=tmp;
}