system("cls") troubles

the code is posted below but what i'm having troubles with is around line 153 at the end of func2 and what i want it to do is only refresh the array but let the user still input and then increase the sleep speed, or to say make the array refresh faster, and i don't know how to do that. any ideas? any questions go ahead and ask.
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176

#include <iostream>
#include <time.h>
#include <stdlib.h>
#include <windows.h>

using namespace std;

// global variables
const static int iMAX = 40;
char cArray[iMAX][iMAX];
int iSize; // currents size
int iAns; //what the answer should be
char cStart;
char cBase; // base characters in array
char cDiff;// the one character thats different
int iUAns; //user answer

// func1 is used to ...
int func1()
{
    system("cls");
    cout << " -------------------------------------------------------------------" << endl;
    cout << " |  You have chosen the Hidden Characters game.                    |" << endl;
    cout << " |  You will be looking for a specific character in this game.     |" << endl;
    cout << " |  All of the characters will be the same save for one.           |" << endl;
    cout << " |  You will be looking for that one character.                    |" << endl;
    cout << " |  If you see the character, enter the key '1'.                   |" << endl;
    cout << " |  If you do not see the character, enter the key '2'             |" << endl;
    cout << " |  Each time you pass a level the size of the field will increase |" << endl;
    cout << " |  Are you ready?                                                 |" << endl;
    cout << " -------------------------------------------------------------------" << endl;


            iSize = 8;
            // Loop below this line
            do
            {
                iSize +=1;
               switch(iSize)
               {
                   case 9: cBase = char(36); cDiff = 'S'; iAns = 1; break;
                   case 10: cBase = char(229); cDiff = 'o';iAns = 1; break;
                   case 11: cBase = char(228); cDiff = 'E';iAns = 1; break;
                   case 12: cBase = char(225); cDiff = 'B';iAns = 1; break;
                   case 13: cBase = char(46); cDiff = char(44);iAns = 1; break;
                   case 14: cBase = char(54); cDiff = char(54); iAns = 2; break;
                   case 15: cBase = char(230); cDiff = 'u';iAns = 1; break;
                   case 16: cBase = char(141); cDiff = 'i';iAns = 1; break;
                   case 17: cBase = char(58); cDiff = char(59);iAns = 1; break;
                   case 18: cBase = char(205); cDiff = char(61); iAns = 1;break;
                   case 19: cBase = char(196); cDiff = char(45);iAns = 1; break;
                   case 20: cBase = char(240); cDiff = char(240); iAns = 2; break;
                   case 21:
                   {
                       system("cls");
                       cout << "\n\n\n\n\n\n\n\n\n\n\n\n" << endl;
                       cout << "The game is now over! You Won! You have an excellent mind, user!" << endl;
                       cout << "\n\n\n\n\n\n\n\n\n\n\n\n" << endl;
                       return 1;
                   }

               }
                 // initialize the array
            for (int x = 0; x < iSize; x++)
            {
                for (int y = 0; y < iSize; y++)
                {
                    cArray[x][y] = cBase;
                }
            }
                // put one char in random spot
                int x = rand()% iSize;
                int y = rand()% iSize;
                cArray[x][y] = cDiff;

                // display everything in array
                for (int x = 0; x<iSize; x++)
                {
                    for (int y = 0; y<iSize; y++)
                    {
                        cout<< cArray[x][y];
                    }
                    cout << endl;
                }
                cout << endl;
                cout << "Enter '1' if you see the character which is different." <<endl;
                cout << "If there is not one, enter '2'" << endl;
                cin >> iUAns;
                if(iUAns != iAns)
                {
                    system("cls");
                    cout << "You lost the game." << endl;
                    return 1;
                }
                system("cls");

        }while(true);
        return 0;
}

/*I'm currently writing the part of the array that will display the random characters
which none of them will be repeated in the array.*/
void func2()
{
    system("cls");
            cout << "----------------------------------------------------------------------------" << endl;
            cout << "|  You have chosen the Moving Menace game.                                 |" << endl;
            cout << "|  You will be looking for a specific character in this game.              |" << endl;
            cout << "|  When you see the character, enter the key 'G'.                          |" << endl;
            cout << "|  Just as a warning the more you find the character, the faster it moves. |" << endl;
            cout << "|  Are you ready?                                                          |" << endl;
            cout << "----------------------------------------------------------------------------" << endl;
            Sleep(1000);
            //It's over 9000!
            cout << "3" << endl;
            Sleep(1000);
            cout << "2" << endl;;
            Sleep(1000);
            cout << "1" << endl;
            Sleep(1000);
            system("cls");
            cout << "GO!";
            Sleep(1000);
            system("cls");

             // initialize the array
            while(1)
            {
                 cout << "Look for this character: '*' \n" << endl;
                char cTest;
                iSize = 16;
                for (int x = 0; x < iSize; x++)
                {
                    for (int y = 0; y < iSize; y++)
                    {
                        cTest = char(rand() % 223 + 33);
                        cArray[x][y] = cTest;
                    }
                }

                // display everything in array
                for (int x = 0; x < iSize; x++)
                {
                    for (int y = 0; y < iSize; y++)
                    {
                        cTest = cArray[x][y];
                        cout<< cTest;
                    }
                    cout << endl;
                }
                Sleep(1500);
                system("cls");
            }

}

int main()
{
    /* initialize random seed: */
    srand ( time(NULL) );

   cout << "---------------------------------" << endl;
   cout << "| Walker Andreasen's Mind Games |" << endl;
   cout << "---------------------------------" << endl;
    cout << "What game would you like to play?" << endl;
    cout << "1: Hidden Characters" << endl;
    cout << "2: Moving Menace" << endl;
    cin >> cStart;
    switch (cStart)
    {
        case '1': if(func1() == 1) {return 0;} ; break;
        case '2': func2(); break;
    }
    return 0;
}
Hi ,
system("cls");
is not used for clearing the buffer or an array it is used to clear the screen .
try flush() to clear the input buffer and memset() to clear the array .
Topic archived. No new replies allowed.