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
|
/*
Create list of letters for first, middle, and last
name that can make up a good match
Get first, middle, and last name.
Display whole name.
Store initials in another variable
Show how many letters are in each name.
If all initials are in the lists
tell user that their initials are a good match
else
tell user that their initials are not a good match
*/
#include <iostream>
#include <string>
using namespace std;
void goodLetters(); // list of good initials for each name
string name(string fml); // get a name to return to first, middle, or last
void goodOrBad(const char& f, const char& m, const char& l); // tell user if they have good initials
int main()
{
void goodLetters();
string first = name("first");
string middle = name("middle");
string last = name("last");
cout << "Your full name is " << first << " " << middle << " " << last << ".\n ";
cout << "\nYour first name has " << first.size() << " letters in it.";
cout << "\nYour middle name has " << middle.size() << " letters in it.";
cout << "\nYour last name has " << last.size() << " letters in it.";
const char fInitial = first[0];
const char mInitial = middle[0];
const char lInitial = last[0];
void goodOrBad(const char& fInitial, const char& mInitial, const char& lInitial);
return 0;
}
void goodLetters()
{
char firstNameLetters[12] = {'A', 'B', 'C', 'E', 'I', 'L', 'M', 'N', 'T', 'Y'};
char middleNameLetters[14] = {'B', 'C', 'D', 'F', 'G', 'H', 'J', 'O',
'Q', 'X', 'V', 'W', 'Y', 'Z'};
char lastNameLetters[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
}
string name(string fml) // fml stands for first, middle, last
{
string temp;
cout << "What is your " << fml << " name? .-*:";
cin >> temp;
return temp;
}
void goodOrBad(const char& f, const char& m, const char& l)
{
for (int i = 0; i < 12; ++i) // here's where I'm not sure how to get the arrays
}
|