Hey, guys. Ok, so I'm pretty much a newbie, but I'm going all out trying to be a legit coder eventually.
So, I'm creating a "Polling Program" as a Practice Program in my training, (Polling which Doctor Who Companion is your favorite, since you asked. Heh.) and even though I'll never actually use this program in a legit capacity, I want to clear the screen after each person inputs their choice. Now, I've seen that the
command is bad form, I saw another option,
|
cout << string(50, '\n');
|
This worked for like the first 10 or so times, then large white boxes, (multiple spaces) started filling up the console in what should be blank areas. What can I do to fix this?
Here's what I have:
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
|
#include <iostream>
#include <string>
using namespace std;
int Choice = 10;
int RoseVotes;
int MarthaVotes;
int DonnaVotes;
int PondVotes;
int ClaraVotes;
char YesNo;
int main()
{
cout << string(50, '\n');
while (Choice != 0)
{
cout << " _\n";
cout << " /-\\\n";
cout << " _____|#|_____\n";
cout << " |_____________|\n";
cout << " |_______________|\n";
cout << " |||_POLICE____BOX_|||\n";
cout << " | |¯|¯|¯|||¯|¯|¯| |\n";
cout << " | |-|-|-|||-|-|-| |\n";
cout << " | |_|_|_|||_|_|_| |\n";
cout << " | ||~~~| | |¯¯¯|| |\n";
cout << " | ||~~~|!|!| O || |\n";
cout << " | ||~~~| |.|___|| |\n";
cout << " | ||¯¯¯| | |¯¯¯|| |\n";
cout << " | || | | | || |\n";
cout << " | ||___| | |___|| |\n";
cout << " | ||¯¯¯| | |¯¯¯|| |\n";
cout << " | || | | | || |\n";
cout << " | ||___| | |___|| |\n";
cout << " |¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout << " ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n";
cout << " -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n";
cout << "Thank you for taking Dallas Wilke's Doctor Who Companion Poll.\n";
cout << "Please enter the corresponding number to your favorite \"New Who\" companion(s):\n\n";
cout << '\t' << "1 - Rose Tyler\n";
cout << '\t' << "2 - Martha Jones\n";
cout << '\t' << "3 - Donna Noble\n";
cout << '\t' << "4 - Amy Pond & Rory Williams\n";
cout << '\t' << "5 - Clara Oswin Oswald\n";
cout << '\t' << "6 - SEE CURRENT RESULTS\n";
cout << '\t' << "0 - Exit Program (Data Will Be Lost)\n";
cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
cout << "Your selection? ";
cin >> Choice;
if (Choice == 1)
{
cout << "\nYou have chosen Rose Tyler. (Press Enter To Continue)\n\n";
RoseVotes++;
cin.get ();
cin.ignore ();
cout << string(50, '\n');
cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
}
else if (Choice == 2)
{
cout << "\nYou have chosen Martha Jones. (Press Enter To Continue)\n\n";
MarthaVotes++;
cin.get ();
cin.ignore ();
cout << string(50, '\n');
cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
}
else if (Choice == 3)
{
cout << "\nYou have chosen Donna Noble. (Press Enter To Continue)\n\n";
DonnaVotes++;
cin.get ();
cin.ignore ();
cout << string(50, '\n');
cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
}
else if (Choice == 4)
{
cout << "\nYou have chosen Amy Pond & Rory Williams. (Press Enter To Continue)\n\n";
PondVotes++;
cin.get ();
cin.ignore ();
cout << string(50, '\n');
cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
}
else if (Choice == 5)
{
cout << "\nYou have chosen Clara Oswin Oswald. (Press Enter To Continue)\n\n";
ClaraVotes++;
cin.get ();
cin.ignore ();
cout << string(50, '\n');
cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
}
else if (Choice == 6)
{
cout << "\n ------------------------------------------------\n";
cout << "|" << '\t' << RoseVotes << '\t' << MarthaVotes<< '\t' << DonnaVotes<< '\t' << PondVotes<< '\t' << ClaraVotes << '\t' << "|\n";
cout << " ------------------------------------------------\n";
cout << " " << '\t' << "Rose" << '\t' << "Martha" << '\t' << "Donna" << '\t' << "Ponds" << '\t' << "Clara\n\n\n";
cout << "Press Enter to Continue.\n\n";
cout << string(50, '\n');
cin.get ();
cin.ignore ();
}
else if (Choice == 0)
{
cout << string(50, '\n');
cout << "\nGoodbye!\n";
}
else
{
cout << "\nInvalid Selection, please choose again. (Press Enter To Continue)\n\n";
cin.get ();
cin.ignore ();
cout << string(50, '\n');
cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
}
}
}
|
I also read somewhere that it is probably easier to load the ASCII art from a text file than doing it like that, but I don't how to do that yet.