Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- int cardcount = 19;
- int side = 1;
- int input;
- char cards[19];
- void checkdeath() {
- if(cardcount == 0 && side == 1) {
- cout << "Player 1 lost" << endl;
- exit(0);
- }
- if(cardcount == 0 && side == 2) {
- cout << "Player 2 lost" << endl;
- exit(0);
- }
- }
- int main()
- { for(int i = 1; i < 19; i++) {
- cards[i] = 'A';
- }
- cards[0] = 'P';
- while(true) {
- if(cardcount == 0 && side == 1) {
- cout << "Player 1 lost" << endl;
- exit(0);
- }
- if(cardcount == 0 && side == 2) {
- cout << "Player 2 lost" << endl;
- exit(0);
- }
- for(int i = 0; i < cardcount; i++) {
- cout << cards[i] << " ";
- }
- cout << endl;
- cout << "Player 1: Options: 1, 2, 3 ";
- cin >> input;
- switch(input) {
- case 1:
- cards[cardcount] = ' ';
- cardcount--;
- break;
- case 2:
- cards[cardcount] = ' ';
- cardcount--;
- cards[cardcount] = ' ';
- cardcount--;
- break;
- case 3:
- cards[cardcount] = ' ';
- cardcount--;
- cards[cardcount] = ' ';
- cardcount--;
- cards[cardcount] = ' ';
- cardcount--;
- break;
- }
- checkdeath();
- side++;
- for(int i = 0; i < cardcount; i++) {
- cout << cards[i] << " ";
- }
- cout << endl;
- cout << "Player 2: Options: 1, 2, 3 ";
- cin >> input;
- switch(input) {
- case 1:
- cards[cardcount] = ' ';
- cardcount--;
- break;
- case 2:
- cards[cardcount] = ' ';
- cardcount--;
- cards[cardcount] = ' ';
- cardcount--;
- break;
- case 3:
- cards[cardcount] = ' ';
- cardcount--;
- cards[cardcount] = ' ';
- cardcount--;
- cards[cardcount] = ' ';
- cardcount--;
- break;
- }
- checkdeath();
- side--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement