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
|
#include<iostream>
#include <cctype>
#include <cstring>
#include <cstdlib>
using namespace std;
void fav_fruit();// fav_fruit prototype
void guess();// guess prototype
int main()
{
char c[80]; char a[80];char b[80];char e[80];
int i,f;
cout << "Yo what's your name?\n" ;
cin >> c;
cout <<"Cool, btw " << c << " wanna play a game?\n" ;
cin >> a;
for (i=0;a[i]; i++){if(isupper(a[i])) a[i] = tolower(a[i]);}
if(!strcmp(a, "yes")){cout << "Ok.\n"; fav_fruit();}
return 0;
}
void fav_fruit()
{
int i;
char d[80];char e[80];
cout << "Guess what's my favorite food is\n" ;
cout << "Apple, Banana, Orange\n\n";
cin >> d;
for (i=0;d[i]; i++)if(isupper(d[i])) d[i] = tolower(d[i]);
if(!strcmp(d, "apple" )) cout << "Apple,,, close,,, but no tangerine!!! \n\n" ;
if(!strcmp(d, "banana")) cout << "well,, I am talking about my favorite to eat,,\n";
if(!strcmp(d, "banana")) cout << "so,,, grudgingly,, NO!!(making 'L' sign on forehead)\n\n";
if(!strcmp(d, "orange")) cout << "Yez!!! now lets do ze bumpitty bump!!!\n";
if(!strcmp(d, "orange"))return;
guess();
}
void guess()
{
int i;
char d[80];char e[80];
cout << "guess again?";
cin >>e;
for (i=0;e[i]; i++){if(isupper(e[i])) e[i] = tolower(e[i]);}
if(!strcmp(e, "yes")) fav_fruit();
else cout << "Well too bad then.\n\n";
return;
}
| |