Animate issue

Do any of you know where to put system("cls") in my code so that the system doesn't keep printing another board, and I just keep the same board. Thanks.

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
int main(void)
{
	char finished; char c;
	bool keep_playing = true;
	
	cout << "Shall We Play A Game Today? \n Yes or No.  (Y,N)" << endl;
	string p;
	cin >> p;

	if (p == "Y" || p == "y")
	{
		system("cls");

		cout << "Welcome To Tic Tac Toe \n\n" << endl;
		cout << "The Human Player will be the X, during this game \n\n" << endl;
		cout << "Here is how to play the game: \n\n 1) You must first enter which row you would like--from top to bottom.                i.e. 1,2,3 and then press enter \n 2) Enter which column you would like, and press enter again. \n      Good luck player \n\n" << endl;

		while (keep_playing)
		{

			
			finished = ' ';
			createboard();

			do {
				displayboard();
				humanplayermove();
				finished = checkforwinner(); /* check winner */
				if (finished != ' ') break; /* if winner found...*/
				computermove();
				finished = checkforwinner(); /* check for winner again */
				if (finished != ' ') break; /* if winner found...*/
				if (checkforadraw(board)) //we don't have a winner and there are no open spaces.
				{

					displayboard();
					cout << endl;
					cout << "The Game has Ended in a Tie, surely you will want to play at least until someone wins human!!\n";
					break;
				}
				newgameboard();

			} while (finished == ' ');
			
			if (finished == 'x')
			{
				cout << "You Have Defeated Me, this is impossible!!!! Let us Play Again....\n";
			}
			else
			{
				cout << "I have defeated you, I always said Machines Would become better than Humans at  their own games. HAHAHA \n\n" << endl;
			}
			displayboard(); /* show final positions */
			cout << "Would You like to go for another round? Y/N" << endl; cin >> c;
			if (c == 'N' || c == 'n')
				keep_playing = false;
			newgameboard();
		}

	}
	else  cout << "Maybe Next Time You will be brave enough to face me."  << endl;

	return 0;
}
Topic archived. No new replies allowed.