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
|
#include <iostream>
#include <ctime>
#include <cstdlib>
/*By the way, does it really matter if I include cstdlib?
I noticed without the header file random numbers can still be generated*/
#include <Windows.h>
#include <string>
void cleanUp(void);
class PeoplesFirstLetterName {
protected:
char 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;
public:
PeoplesFirstLetterName
(char setA=('A'), char setB=('B'), char setC=('C'), char setD=('D'), char setE=('E'), char setF=('F'),
char setG=('G'), char setH=('H'), char setI=('I'), char setJ=('J'), char setK=('K'), char setL=('L'),
char setM=('M'), char setN=('N'), char setO=('O'), char setP=('P'), char setQ=('Q'), char setR=('R'),
char setS=('S'), char setT=('T'), char setU=('U'), char setV=('V'), char setW=('W'), char setX=('X'),
char setY=('Y'), char setZ=('Z')) {
a=setA, b=setB, c=setC, d=setD, e=setE, f=setF, g=setG, h=setH, i=setI, j=setJ, k=setK, l=setL,
m=setM, n=setN, o=setO, p=setP, q=setQ, r=setR, s=setS, t=setT, u=setU, v=setV, w=setW, x=setX,
y=setY, z=setZ;
}
};
class FirstLetters : public PeoplesFirstLetterName {
public:
void letterA() {std::cout<<("Someone with the Letter: ")<<(a)<<("\nis talking about you")<<std::endl;};
void letterB() {std::cout<<("Someone with the Letter: ")<<(b)<<("\nis talking about you")<<std::endl;};
void letterC() {std::cout<<("Someone with the Letter: ")<<(c)<<("\nis talking about you")<<std::endl;};
void letterD() {std::cout<<("Someone with the Letter: ")<<(d)<<("\nis talking about you")<<std::endl;};
void letterE() {std::cout<<("Someone with the Letter: ")<<(e)<<("\nis talking about you")<<std::endl;};
void letterF() {std::cout<<("Someone with the Letter: ")<<(f)<<("\nis talking about you")<<std::endl;};
void letterG() {std::cout<<("Someone with the Letter: ")<<(g)<<("\nis talking about you")<<std::endl;};
void letterH() {std::cout<<("Someone with the Letter: ")<<(h)<<("\nis talking about you")<<std::endl;};
void letterI() {std::cout<<("Someone with the Letter: ")<<(i)<<("\nis talking about you")<<std::endl;};
void letterJ() {std::cout<<("Someone with the Letter: ")<<(j)<<("\nis talking about you")<<std::endl;};
void letterK() {std::cout<<("Someone with the Letter: ")<<(k)<<("\nis talking about you")<<std::endl;};
void letterL() {std::cout<<("Someone with the Letter: ")<<(l)<<("\nis talking about you")<<std::endl;};
void letterM() {std::cout<<("Someone with the Letter: ")<<(m)<<("\nis talking about you")<<std::endl;};
void letterN() {std::cout<<("Someone with the Letter: ")<<(n)<<("\nis talking about you")<<std::endl;};
void letterO() {std::cout<<("Someone with the Letter: ")<<(o)<<("\nis talking about you")<<std::endl;};
void letterP() {std::cout<<("Someone with the Letter: ")<<(p)<<("\nis talking about you")<<std::endl;};
void letterQ() {std::cout<<("Someone with the Letter: ")<<(q)<<("\nis talking about you")<<std::endl;};
void letterR() {std::cout<<("Someone with the Letter: ")<<(r)<<("\nis talking about you")<<std::endl;};
void letterS() {std::cout<<("Someone with the Letter: ")<<(s)<<("\nis talking about you")<<std::endl;};
void letterT() {std::cout<<("Someone with the Letter: ")<<(t)<<("\nis talking about you")<<std::endl;};
void letterU() {std::cout<<("Someone with the Letter: ")<<(u)<<("\nis talking about you")<<std::endl;};
void letterV() {std::cout<<("Someone with the Letter: ")<<(v)<<("\nis talking about you")<<std::endl;};
void letterW() {std::cout<<("Someone with the Letter: ")<<(w)<<("\nis talking about you")<<std::endl;};
void letterX() {std::cout<<("Someone with the Letter: ")<<(x)<<("\nis talking about you")<<std::endl;};
void letterY() {std::cout<<("Someone with the Letter: ")<<(y)<<("\nis talking about you")<<std::endl;};
void letterZ() {std::cout<<("Someone with the Letter: ")<<(z)<<("\nis talking about you")<<std::endl;};
};
void menu() {
std::string tab(6,('\t')), tab1(4,('\t')), tab2(5,('\t')), underScores(80,('_'));
std::cout<<("Who is talking about you?")<<(tab)<<("\b[FindOut]")
<<(underScores)<<(tab1)<<("\b\bType in<[ who ]>to begin")<<std::endl
<<std::endl
<<(tab2)<<("\b:> ");
}
int main() {
FirstLetters expose;
srand(NULL(time));
int iRandom(0+rand()%27);
bool dontExit(false);
menu();
std::string input;
do {
std::cin>>input;
if (input == ("who")) {
if (iRandom == 1) {
expose.letterA();
} else if (iRandom == 2) {
expose.letterB();
} else if (iRandom == 3) {
expose.letterC();
} else if (iRandom == 4) {
expose.letterD();
} else if (iRandom == 5) {
expose.letterE();
} else if (iRandom == 6) {
expose.letterF();
} else if (iRandom == 7) {
expose.letterG();
} else if (iRandom == 8) {
expose.letterH();
} else if (iRandom == 9) {
expose.letterI();
} else if (iRandom == 10) {
expose.letterJ();
} else if (iRandom == 11) {
expose.letterK();
} else if (iRandom == 12) {
expose.letterL();
} else if (iRandom == 13) {
expose.letterM();
} else if (iRandom == 14) {
expose.letterN();
} else if (iRandom == 15) {
expose.letterO();
} else if (iRandom == 16) {
expose.letterP();
} else if (iRandom == 17) {
expose.letterQ();
} else if (iRandom == 18) {
expose.letterR();
} else if (iRandom == 19) {
expose.letterS();
} else if (iRandom == 20) {
expose.letterT();
} else if (iRandom == 21) {
expose.letterU();
} else if (iRandom == 22) {
expose.letterV();
} else if (iRandom == 23) {
expose.letterW();
} else if (iRandom == 24) {
expose.letterX();
} else if (iRandom == 25) {
expose.letterY();
} else if (iRandom == 26) {
expose.letterZ();
}
} else {
std::cout<<("\nInvalid Command\n");
}
} while(!dontExit);
return 0;
}
void cleanUp(void) { /*FYI this is to clear, but I have not used it yet because of my issue*/
DWORD n, size;
COORD coord={0};
CONSOLE_SCREEN_BUFFER_INFO csbi;
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(h, &csbi);
size = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(h, TEXT(' '), size, coord, &n);
GetConsoleScreenBufferInfo(h, &csbi);
FillConsoleOutputAttribute(h, csbi.wAttributes, size, coord, &n);
SetConsoleCursorPosition(h, coord);
}
|