-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcountercard2.cpp
More file actions
119 lines (94 loc) · 2.4 KB
/
Copy pathcountercard2.cpp
File metadata and controls
119 lines (94 loc) · 2.4 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
pj92singh
Prabhjit Singh
Sequential card showing program
-Counts the next batch of cards for position
the player is in the game "(next/cheat)"
-Must tell the program what position and
how many players are playing
i.e.
----------------------------------------------
5 players
1st 2nd position 3rd 4th 5th
A 2 3 4 5
6 7 8 9 10
J Q K A 2
----------------------------------------------
3 players
1st position 2nd 3rd
A 2 3
4 5 6
7 8 9
10 J Q
K A 2
----------------------------------------------
*/
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
//ask for postion and players
void questions(int players, int postion){
cout << "How many players?\n";
cin >>players;
cout << "Your postion\n";
cin >>postion;
}
/*
void vector_out_put(hecto n){
for (vector<string>::iterator it_1=n.begin(); it_1!=n.end(); it_1+=5)
cout << ' ' << *it_1;
cout << '\n';
}
*/
/*
void output_cards(hecto q, int players, int postion){
int i;
//show the cards the have to play next
cout << "**********\n *** Your cards ***\n";
for(i = postion; i < 3; i+= i)
{
for (vector<string>::iterator it_1=q.begin(); it_1!=q.end(); it_1+=5)
cout << ' ' << *it_1;
cout << '\n';
}
}
*/
int main(int argc, char const *argv[])
{
int players, postion;
string cards[13] = {{'A'}, {'2'}, {'3'}, {'4'}, {'5'},
{'6'}, {'7'}, {'8'}, {'9'}, {"10"},
{'J'}, {'Q'}, {'K'} };
std::vector<string> q(cards, cards+13);
cout<< "\n The Orginal Vector\n";
for (vector<string>::iterator it_1=q.begin(); it_1!=q.end(); ++it_1)
cout << ' ' << *it_1;
cout << '\n';
//start asking questions
cout << "How many players?\n";
cin >>players;
cout << "Your postion\n";
cin >>postion;
int i, knt = 1;
//std::iterator it_1;
if(players != postion ){
//show the cards the have to play next
cout << "**********\n *** Your cards ***\n";
for (vector<string>::iterator it_1=q.begin()+(postion-1); it_1!=q.end(); it_1+=(players))
cout << ' ' << *it_1;
/*if(it_1 > q.end())
{
it_1 = q.begin();
knt++;
}*/
cout << '\n';
}
else{
cout << "**********\n *** Your next cards are: ***\n";
for (vector<string>::iterator it_1=q.begin()+(postion-1); it_1!=q.end(); it_1+=(postion))
cout << ' ' << *it_1;
cout << '\n';
}
return 0;
}