First open your c++ IDE. after that create a new project and put these codes inside.
#include
#include
#include
#include
using namespace MatrixC;
int main()
{
system("color 0a");
srand(time(0));
char random_char = ((rand() % 127));
bool going = true, checking = true;
while (going = true)
{
for (int x = 0; x < 38; x++)
{
random_char = ((rand() % 127) + 50);
checking = true;
while (checking)
{
if (
(random_char == 32) || (random_char == 39) || (random_char == 46) ||
(random_char == 44) || (random_char == 34) || (random_char == 45) ||
(random_char == 58) || (random_char == 59) || (random_char == 94) ||
(random_char == 95) || (random_char == 96) || (random_char == 126)
)
random_char = ((rand() % 127) + 50);
else break;
}
cout << random_char << " ";
}
cout << endl;
Sleep(20);
}
cin.get();
return 0;
}
The includes are the namespaces in c++ , the code
system("color 0a"); is the green color text of our Matrix effect (color oa is the system name for green) ,
srand(time(0)); is the random speed ,
for (int x = 0; x < 38; x++) draws the rows of characters ,
random_char = ((rand() % 127) + 50);
checking = true;
while (checking) generates the first character ,
this
(random_char == 32) || (random_char == 39) || (random_char == 46) ||
(random_char == 44) || (random_char == 34) || (random_char == 45) ||
(random_char == 58) || (random_char == 59) || (random_char == 94) ||
(random_char == 95) || (random_char == 96) || (random_char == 126)
checks for bad characters ,
this
random_char = ((rand() % 127) + 50); generates random characters if bad characters generated , this
else break; will continue to print if good characters generated , this
cout << random_char << " "; prints character , this
cout << endl; if full characters were printed will continue to next row , this delays
Sleep(20); .
You can see a preview of the matrix on top of this post.