Guest User

Untitled

a guest
Feb 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <windows.h>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     string dotSymbol = "Û";
  11.     string dotPoint = dotSymbol;
  12.     string eSpace = "";
  13.     string spacer[] = {"²", "±", "°"};   // "²", "±", "°"
  14.     int i;
  15.     int sTime = 20;
  16.     int lWidth = 1;
  17.     int spacerLength = sizeof(spacer) / sizeof(spacer[0]);
  18.  
  19.     srand (time (NULL));
  20.  
  21.     // Check and set user-defined "line" width
  22.     // Set limits
  23.     cout << "Line width (1-5): ";
  24.     cin >> lWidth;
  25.     for (int w = 1; w < lWidth; w++) {
  26.         if(lWidth < 1) {
  27.             break;
  28.         }
  29.         dotPoint += dotSymbol;
  30.         if (dotPoint.length() >= 5) {
  31.             break;
  32.         }
  33.     }
  34.     // Start printing for eternity!
  35.     while(true) {
  36.         eSpace = "";
  37.         int random = rand() % 70;
  38.         // Up up, and away!
  39.         for(i = 0; i < random; i++) {
  40.             if(i > 0) {
  41.                 eSpace += spacer[rand() % spacerLength];
  42.                 Sleep(sTime);
  43.                 cout << eSpace + dotPoint << endl;
  44.             }
  45.             else cout << dotPoint << endl;
  46.         }
  47.         // What goes up, must come down
  48.         for(int j = i; j > 0; j--) {
  49.             string decSpace = eSpace.substr(0, i-1);
  50.             i--;
  51.             Sleep(sTime);
  52.             cout << decSpace + dotPoint << endl;
  53.         }
  54.     }
  55. }
  56. // End of tardcode
  57.  
  58. // TODO: Error handling... Naaah.
Add Comment
Please, Sign In to add comment