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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
void CurrentFriendScore(int&, int);
char returner();
int main()
{
int num = 0, FriendScore = 0;
char foodQ = '0', sportsQ = '0', moviesQ = '0', beverageQ = '0';
cout << "~ Phil's Friendship Algorithm ! ~ " << endl;
cout << "********************************** " << endl;
cout << "This program will implement a friendship algorithm to determine if someone could be your friend !" << endl;
cout << "********************************** " << endl;
cout << "100 is the best score. -20 is the worst ! " << endl;
cout << "********************************** " << endl;
cout << "Calling potential friend.." << endl;
cout << "User answers phone " << endl; // USER INPUT STARTS
// FOOD
cout << "Hey ! Do you want to get some food? (y/n): " << endl;
foodQ = returner();
if (foodQ == 'Y')
{
cout << "Yay! What do you prefer ?" << "(1-Seafood, 2-steak, or 3-vegetarian) " << endl;
cin >> num;
CurrentFriendScore(FriendScore, num);
cout << "Cool let's grub out . Can you pick me up ? " << endl;
cout << "(1-Yes, 2-I lost my license, but my neighbor will take us, 3-Wow, you called me so you should pick ME up, but sure I'll come by soon) " << endl;
cin >> num;
CurrentFriendScore(FriendScore, num);
}
if (foodQ != 'Y')
{
// SPORTS
cout << "Ok no problem. Do you like sports? (y/n): " << endl;
sportsQ = returner();
}
if (sportsQ == 'Y')
{
cout << "Heck Ya ! Me too ! What do you want to play ?" << endl;
cout << "(1-Basketball, 2-Baseball, 3-Football) " << endl;
cin >> num;
CurrentFriendScore(FriendScore, num);
cout << "Awesome ! I lost my ball though .. can you bring one ? " << endl;
cout << "(1-Yes, 2-I would but I don't have one either. I'll ask my neighbor, 3-No, you bring one) ";
cin >> num;
CurrentFriendScore(FriendScore, num);
}
if (foodQ != 'Y' && sportsQ != 'Y')
{
// MOVIES
cout << "Alright. I'm tired anyways. How about a movie ?! (y/n) " << endl;
moviesQ = returner();
}
if (moviesQ == 'Y')
{
cout << "Awesome ! What type of movie do you want to see ?" << endl;
cout << "(1-Action, 2-Suspense, 3-Romance) " << endl;
cin >> num;
CurrentFriendScore(FriendScore, num);
cout << "Cool ! I'll bring the popcorn ! Can you bring the drinks ? " << endl;
cout << "(1-Yes, 2-Maybe, 3-No) " << endl;
cin >> num;
CurrentFriendScore(FriendScore, num);
}
if (foodQ != 'Y' && sportsQ != 'Y' && moviesQ != 'Y')
{
// BEVERAGES
cout << "Ya movie tickets are pretty expensive. How about we get something to drink ? Nothing expensive or tiring. What do you say ? (y/n) " << endl;
beverageQ = returner();
}
if (beverageQ == 'Y')
{
cout << " Cool lets do it. What kind of beverage do you want to get ? " << endl;
cout << "(1-Coffee, 2-Beer, 3-Tea) " << endl;
cin >> num;
CurrentFriendScore(FriendScore, num);
cout << "Cool, I'll come by and pick you up. See ya in a bit ! " << endl;
cout << " O Wait !! Before I go, I wanted to tell you not to bring any money. I'll pay. Is that ok ?" << endl;
cout << "(1-Yes, 2-Maybe, 3-No, I'm grown I can pay for myself) " << endl;
cin >> num;
CurrentFriendScore(FriendScore, num);
}
if (foodQ != 'Y' && sportsQ != 'Y' && moviesQ != 'Y' && beverageQ != 'Y')
{
cout << "Darn. Alright well I guess I'll talk to you later. Can I call back another time?" << endl;
cout << "(1-Yes, 2-I'll call you, 3-No) " << endl;
cin >> num;
CurrentFriendScore(FriendScore, num);
}
return 0;
}
char returner()
{
char reply = '0';
cin >> reply;
return toupper(reply);
}
void CurrentFriendScore(int ¤tTotal, int x)
{
int score = 0;
if (x == 1)
score = 50;
if (x == 2)
score = 25;
if (x == 3)
score = -10;
currentTotal += score;
cout << "*** Your friendscore is " << currentTotal << " !! ***" << endl;
return;
}
|