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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
struct girlscore
{
string name;
int pretty;
int smart;
int crazy;
double total = 0;
};
int main()
{
girlscore girl1;
girlscore girl2;
girlscore girl3;
int numgirls;
cout << "How many girls would you like to rate: ";
cin >> numgirls;
if(numgirls >= 3)
{
cout << "\nEnter the name of girl one: ";
cin.ignore();
getline(cin, girl1.name);
cout << "1-100, how pretty?" << endl;
cin >> girl1.pretty;
cout << "1-100, how smart?" << endl;
cin >> girl1.smart;
cout << "1-100, how crazy?" << endl;
cin >> girl1.crazy;
girl1.total = (girl1.pretty + girl1.smart + girl1.crazy)/3;
cout << "\nEnter the name of girl two: ";
cin.ignore();
getline(cin, girl2.name);
cout << "1-100, how pretty?" << endl;
cin >> girl2.pretty;
cout << "1-100, how smart?" << endl;
cin >> girl2.smart;
cout << "1-100, how crazy?" << endl;
cin >> girl2.crazy;
girl2.total = (girl2.pretty + girl2.smart + girl2.crazy)/3;
cout << "\nEnter the name of girl three: ";
cin.ignore();
getline(cin, girl3.name);
cout << "1-100, how pretty?" << endl;
cin >> girl3.pretty;
cout << "1-100, how smart?" << endl;
cin >> girl3.smart;
cout << "1-100, how crazy?" << endl;
cin >> girl3.crazy;
girl3.total = (girl3.pretty + girl3.smart + girl3.crazy)/3;
//checks for winner
if(girl1.total == girl2.total && girl2.total == girl3.total)
{cout << "\nMarry any of them, same scores!" << endl;}
else if (girl1.total > girl2.total && girl1.total > girl3.total)
{cout << "\nMarry girl one!" << endl;}
else if( girl1.total < girl2.total && girl2.total > girl3.total)
{cout << "\nMarry girl two!" << endl;}
else if(girl3.total > girl1.total && girl3.total > girl2.total)
{cout << "\nMarry girl three!" << endl;}
//print stats
cout << "\nHere are the stats:" << endl << endl;
cout << girl1.name << endl;
cout << "Pretty: " << girl1.pretty << endl;
cout << "Smart: " << girl1.smart << endl;
cout << "Crazy: " << girl1.crazy << endl;
cout << "Total: " << girl1.total << endl << endl;
cout << girl2.name << endl;
cout << "Pretty: " << girl2.pretty << endl;
cout << "Smart: " << girl2.smart << endl;
cout << "Crazy: " << girl2.crazy << endl;
cout << "Total: " << girl2.total << endl << endl;
cout << girl3.name << endl;
cout << "Pretty: " << girl3.pretty << endl;
cout << "Smart: " << girl3.smart << endl;
cout << "Crazy: " << girl3.crazy << endl;
cout << "Total: " << girl3.total << endl;
}
else if(numgirls >=2) //for two girls
{
cout << "\nEnter the name of girl one: ";
cin.ignore();
getline(cin, girl1.name);
cout << "1-100, how pretty?" << endl;
cin >> girl1.pretty;
cout << "1-100, how smart?" << endl;
cin >> girl1.smart;
cout << "1-100, how crazy?" << endl;
cin >> girl1.crazy;
girl1.total = (girl1.pretty + girl1.smart + girl1.crazy)/3;
cout << "\nEnter the name of girl two: ";
cin.ignore();
getline(cin, girl2.name);
cout << "1-100, how pretty?" << endl;
cin >> girl2.pretty;
cout << "1-100, how smart?" << endl;
cin >> girl2.smart;
cout << "1-100, how crazy?" << endl;
cin >> girl2.crazy;
girl2.total = (girl2.pretty + girl2.smart + girl2.crazy)/3;
//check for winner
if(girl1.total == girl2.total)
{cout << "Marry either of them!" << endl;}
else if(girl1.total > girl2.total)
{cout << "Marry girl one!" << endl;}
else if(girl1.total < girl2.total)
{cout << "Marry girl two!" << endl;}
// prints stats
cout << "\nHere are the stats:" << endl << endl;
cout << girl1.name << endl;
cout << "Pretty: " << girl1.pretty << endl;
cout << "Smart: " << girl1.smart << endl;
cout << "Crazy: " << girl1.crazy << endl;
cout << "Total: " << girl1.total << endl << endl;
cout << girl2.name << endl;
cout << "Pretty: " << girl2.pretty << endl;
cout << "Smart: " << girl2.smart << endl;
cout << "Crazy: " << girl2.crazy << endl;
cout << "Total: " << girl2.total << endl;
}
return 0;
}
|