Skip to content

Instantly share code, notes, and snippets.

Created December 8, 2013 22:30
Show Gist options
  • Save anonymous/5cd22373bdfb14bd9f84 to your computer and use it in GitHub Desktop.
Save anonymous/5cd22373bdfb14bd9f84 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
using namespace std;
int getguess(int);
bool checkMatch(int, int[]);
int main ( ) {
int userinput;
const int FIVE = 5;
int numguessed = 0;
int compcards[FIVE] = {1,2,3,4,5};
int score = 0;
for(int i = 0; i<5; i++){
userinput = getguess(numguessed);
cout<<userinput<<endl;
checkMatch(userinput,compcards);
cout << score << endl;
return 0;
}
}
bool checkMatch(int checkcard, int compcards[]){
for (int i=0; i<5; i++){
if (compcards[i] == checkcard)
{
return true;
}
else(compcards[i] != checkcard){
return false;
}
}
}
int getguess(int num){
string cardstrings[24] = {"fierce tiger", "funny tiger", "silly tiger", "clever tiger", "fierce rabbit",
"funny rabbit", "sily rabbit", "clever rabbit", "fierce monkey", "funny monkey", "silly monkey", "clever monkey",
"fierce rooster", "funny rooster", "silly rooster", "clever rooster", "fierce horse", "funny horse",
"silly horse", "clever horse", "fierce ram", "funny ram", "silly ram", "clever ram"};
string userinput;
cout<<"Guess a card"<<endl;
getline(cin,userinput);
if(userinput == "fierce tiger"){
num = 1;}
else if(userinput == "funny tiger"){
num = 2;}
else if(userinput == "silly tiger"){
num =3; }
else if(userinput == "clever tiger"){
num =4; }
else if(userinput == "fierce rabbit"){
num =5; }
else if(userinput == "funny rabbit"){
num =6; }
else if(userinput == "silly rabbit"){
num =7; }
else if(userinput == "clever rabbit"){
num =8; }
else if(userinput == "fierce monkey"){
num =9; }
else if(userinput == "funny monkey"){
num =10; }
else if(userinput == "silly monkey"){
num =11; }
else if(userinput == "clever monkey"){
num =12; }
else if(userinput == "fierce rooster"){
num =13; }
else if(userinput == "funny rooster"){
num =14; }
else if(userinput == "silly rooster"){
num =15; }
else if(userinput == "clever rooster"){
num =16; }
else if(userinput == "fierce horse"){
num =17; }
else if(userinput == "funny horse"){
num =18; }
else if(userinput == "silly horse"){
num =19; }
else if(userinput == "clever horse"){
num =20; }
else if(userinput == "fierce ram"){
num =21; }
else if(userinput == "funny ram"){
num =22; }
else if(userinput == "silly ram"){
num =23; }
else if(userinput == "clever ram"){
num =24; }
return num;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment