The Matrix: Char Reloaded

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 155
Reputation: amrith92 is on a distinguished road 
Solved Threads: 18
amrith92's Avatar
amrith92 amrith92 is offline Offline
Junior Poster

The Matrix: Char Reloaded

 
0
  #1
Sep 6th, 2008
Here's a funny program that simulates the matrix...waaay off topic...

  1. #include <iostream>
  2. #include <ctime>
  3.  
  4. using namespace std;
  5.  
  6. const int NotUsed=system("color 02");
  7.  
  8. int main()
  9. {
  10. clock();
  11. int n;
  12. double time;
  13. char matrixwords[]=" aijk FGHIJKlmnopqrs ABCDtuvELMNO PQRS bcde fghTUVWXYwxyzZ";
  14. char matrix[]="01001100100101011110";
  15.  
  16. clock();
  17. for(int o=1; o<=70; o++)
  18. {
  19. cout << "/";
  20. }
  21. cout << "\n\n\t\t\tThe Matrix\n\n";
  22. for(int o=1; o<=70; o++)
  23. {
  24. cout << "/";
  25. }
  26. cout << "\n\n\tEnter Matrix ID: (KB's of Data) ::==:: ";
  27. cin >> n;
  28. for(double t=-1000; t<=1000000; t++);
  29. cout << "\n\n\tLoading Matrix Engine.";
  30. for(double t=0; t<=5; t++)
  31. {
  32. for(double u=-10000; u<=10000000; u++);
  33. cout << " . ";
  34. }
  35. time=clock()/1000.0;
  36. cout << "\n\n\t\tYou waited " << time << " seconds for the matrix to generate\n\n\t";
  37.  
  38. for(int i=1; i<=n; i++)
  39. {
  40. for(int j=1; j<=60; j++)
  41. {
  42. if((j%2==0) || (j%5==0) || (j%13==0))
  43. {
  44. int ran( rand()%21 );
  45. cout << matrix[ran];
  46. }
  47. else if(j%3==0)
  48. {
  49. int ran( rand()%66 );
  50. cout << matrixwords[ran];
  51. }
  52. else if(j%7==0)
  53. {
  54. int ran( rand()%66 );
  55. cout << matrixwords[ran];
  56. }
  57. else
  58. {
  59. int ran( rand()%66 );
  60. cout << matrixwords[ran];
  61. }
  62. }
  63. cout << "\n\t";
  64. }
  65. time+=clock()/1000.0;
  66.  
  67. cout << "\n\n\tTotal Time Taken for the Matrix to Run: " << time << " s\n\n\t";
  68. cin.get();
  69. return 0;
  70. }

programmed in c++.. kinda dumb..but still
"C++ : Where friends have access to your private members."
C++: You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can't tell which are bitwise copies and which are just pointing at others and saying, "That's me, over there."
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: The Matrix: Char Reloaded

 
0
  #2
Sep 6th, 2008
Yes, it's a severe blow for all C++-lovers...
And your question is...
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 68
Reputation: Tigran is an unknown quantity at this point 
Solved Threads: 6
Tigran Tigran is offline Offline
Junior Poster in Training

Re: The Matrix: Char Reloaded

 
0
  #3
Sep 7th, 2008
Compiled id, kindda funny ya, though...
Not really usefull to be honest
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 155
Reputation: amrith92 is on a distinguished road 
Solved Threads: 18
amrith92's Avatar
amrith92 amrith92 is offline Offline
Junior Poster

Re: The Matrix: Char Reloaded

 
-1
  #4
Sep 7th, 2008
Originally Posted by ArkM View Post
Yes, it's a severe blow for all C++-lovers...
And your question is...
No question...I just thought it was kinda funny...it was in another forum, but got moved here...

Originally Posted by Tigran View Post
Compiled id, kindda funny ya, though...
Not really usefull to be honest
Yeah...there is no point in the code...it just simulates the matrix
Last edited by amrith92; Sep 7th, 2008 at 8:44 am.
"C++ : Where friends have access to your private members."
C++: You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can't tell which are bitwise copies and which are just pointing at others and saying, "That's me, over there."
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: The Matrix: Char Reloaded

 
0
  #5
Sep 7th, 2008
Well, in that case a free advice for a C++ coder: look at the C++ language definition. Must be int main() , not improbable void main() in signature ...
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: The Matrix: Char Reloaded

 
0
  #6
Sep 7th, 2008
Whatever it is, it looks pretty lame and probably could be improved with a clearscreen function that is system dependent.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 155
Reputation: amrith92 is on a distinguished road 
Solved Threads: 18
amrith92's Avatar
amrith92 amrith92 is offline Offline
Junior Poster

Re: The Matrix: Char Reloaded

 
0
  #7
Sep 7th, 2008
Originally Posted by ArkM View Post
Well, in that case a free advice for a C++ coder: look at the C++ language definition. Must be int main() , not improbable void main() in signature ...
Yeah...I know about that but int main() would need a return statement, which would make my signature 6 lines, one more than is allowed... and anyway, its only just a signature!
Last edited by amrith92; Sep 7th, 2008 at 2:05 pm.
"C++ : Where friends have access to your private members."
C++: You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can't tell which are bitwise copies and which are just pointing at others and saying, "That's me, over there."
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: The Matrix: Char Reloaded

 
0
  #8
Sep 7th, 2008
Reminds me of the grandaddy of all screensavers. Something like
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <time.h>
  4.  
  5. int main()
  6. {
  7. srand( time( NULL ) );
  8. while (1) printf( "%*c", rand() % 15, '*' );
  9. return 0;
  10. }
(This, of course, is just the simplest possible version...)
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: The Matrix: Char Reloaded

 
0
  #9
Sep 7th, 2008
Thank you, Duodas, for this brilliant code!
It's so pity it's not a part of the C RTL...
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 155
Reputation: amrith92 is on a distinguished road 
Solved Threads: 18
amrith92's Avatar
amrith92 amrith92 is offline Offline
Junior Poster

Re: The Matrix: Char Reloaded

 
0
  #10
Sep 7th, 2008
You gotta admit, the Classics are good!
"C++ : Where friends have access to your private members."
C++: You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can't tell which are bitwise copies and which are just pointing at others and saying, "That's me, over there."
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC