Friday, September 20, 2019

Train Animation in Dev C++

#include <windows.h>
#include <iostream.h>
#include <conio.h>

int main()
{ char train[][92] = { { "                                      (@@@)     (@@@@@)                " },
                       { "                               (@@)     (@@@@@@@)        (@@@@@@@)     " },
                       { "                         (@@@@@@@)   (@@@@@)       (@@@@@@@@@@@)       " },
                       { "                    (@@@)     (@@@@@@@)   (@@@@@@)             (@@@)   " },
                       { "               (@@@@@@)    (@@@@@@)                (@)                 " },
                       { "           (@@@)  (@@@@)           (@@)                                " },
                       { "        (@@)              (@@@)                                        " },
                       { "       .-.                                                             " },
                       { "       ] [    .-.      _    .-----.                                    " },
                       { "     .\"   \"\"\"\"   \"\"\"\"\"\" \"\"\"\"| .--`                      " },
                       { "    (:--:--:--:--:--:--:--:-| [___    .------------------------.       " },
                       { "     |C&O  :  :  :  :  :  : [_9_] |'='|.----------------------.|       " },
                       { "    /|.___________________________|___|'--.___.--.___.--.___.-'|       " },
                       { "   / ||_.--.______.--.______.--._ |---\\'--\\-.-/==\\-.-/==\\-.-/-'/-- " },
                       { "  /__;^=(==)======(==)======(==)=^~^^^ ^^^^(-)^^^^(-)^^^^(-)^^^        " },
                     };
  
  char spaces[50] = "                                                 ";
  for(int i=49; i>=0; i--)
  { spaces[i] = '\0';

    for(int j=0; j<15; j++)
    { cout << spaces;
      cout << train[j] << "\n";
    }
    cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
    Sleep(40);
    system("CLS");
  }
  
  getch();
}

No comments:

Post a Comment