Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: cpp
os: linux
script:
- make
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/david-luther/SplitOrSteal.svg?branch=master)](https://travis-ci.org/david-luther/SplitOrSteal)

# SplitOrSteal

**Split Or Steal** is a console application 2-player game. Each player provides their first name and then individually decides if they want to "split" or "steal." If both players choose "split" then they both get half of the prize. However, if one chooses "split" while the other chooses "steal," the player who stole gets the entire prize (and the other gets nothing). Unfortunately, if both players are greedy and both choose "steal" then they both lose!
Expand Down
11 changes: 11 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
//Kevin Buffardi (with help of class)
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

int main()
{
char play_again = ' ';
//player names
string player1name = "";
string player2name = "";
Expand All @@ -13,6 +15,7 @@ int main()
char decision1 = ' ';
char decision2 = ' ';

do {

cout<<"Player 1, please enter your name: ";
cin>>player1name;
Expand All @@ -33,6 +36,9 @@ int main()
cout<<player2name<<", please enter the character of your choice...\n";
cin>>decision2;

decision1 = tolower(decision1);
decision2 = tolower(decision2);

if(decision1 == 't' && decision2 == 's')
{
cout<<player1name<<" stole while "<<player2name<<" split. "
Expand All @@ -54,6 +60,11 @@ int main()
<<"win a prize and go home with NOTHING!\n";
}

cout << "Do you want to play again?\n";
cin >> play_again;

} while (tolower(play_again) == 'y');




Expand Down