1111 - #include<iostream> #include<algorithm>...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> #include<algorithm> #include<vector> using namespace std; enum { SIZ = 5, }; const char cStr[] = "JQKA"; int getVal(char c){ int i; if (isdigit(c)){ return c-'0'; } for (i=0; cStr[i] & cStr[i]!=c; ++i) ; if (cStr[i]) return 11 + i; } char buf[10]; struct Card { int val; char type; bool read(){ if (scanf("%s", buf) <= 0) return false; type = buf[1]; val = getVal(buf[0]); return true; } return val < o.val; } }; struct Node { Card car[5]; vector<int> vec; bool read(){ for (int i=0; i<5; ++i){ if(!car[i].read()) return false; } sort(car, car+5); vec.clear(); return true; } int i; for (int i=0; i<vec.size()&i if (vec[i] != o.vec[i]) return vec[i] - o.vec[i]; } return 0; } int calcMost(){ int m = 0, v=1; for(int i=0; i<4; ++i){ if (car[i].val == car[i+1].val){ ++v; }else { v = 1; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
if (m < v) m = v; } return m; } bool StraightFlush(){ for(int i=0; i<4; ++i){ if(car[i].type!=car[i+1].type || car[i].val+1 != car[i+1].val)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

1111 - #include&lt;iostream&gt; #include&lt;algorithm&gt;...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online