Advertisement
Rishik999

Move Box Move

May 8th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. // MoveBoxMove.cpp : main project file.
  2.  
  3. #include "stdafx.h"
  4. #include<stdio.h>
  5. #include<iostream>
  6.  
  7. using namespace System;
  8. using namespace std;
  9. using namespace System::Threading;
  10.  
  11.  
  12.  
  13. void box (int x, int y, int s,int t, Char Ch,bool pen)
  14.  
  15. {
  16. for(int i=0; i<s; i++)
  17. {
  18. if(pen==true);
  19. Console :: SetCursorPosition (x+i,y);
  20. putchar(Ch);
  21. Console :: SetCursorPosition (x+i,y);
  22. putchar(Ch);
  23. Console:: SetCursorPosition (x,y+i);
  24. putchar(Ch);
  25. Console:: SetCursorPosition (x,y+i);
  26. putchar(Ch);
  27. Thread::Sleep(t);
  28.  
  29. if(pen==false);
  30. Console :: SetCursorPosition (x+i,y);
  31. putchar(Ch);
  32. Console :: SetCursorPosition (x+i,y);
  33. putchar(Ch);
  34. Console:: SetCursorPosition (x,y+i);
  35. putchar(Ch);
  36. Console:: SetCursorPosition (x,y+i);
  37. putchar(Ch);
  38.  
  39. }
  40. }
  41.  
  42.  
  43.  
  44. void box2 (int x, int y, int s,int t, Char Ch, bool pen)
  45.  
  46. {
  47. for(int i=0; i<s; i++)
  48. {
  49. if(pen==true);
  50. Console :: SetCursorPosition (x-i,y);
  51. putchar(Ch);
  52. Console :: SetCursorPosition (x-i,y);
  53. putchar(Ch);
  54. Console:: SetCursorPosition (x,y-i);
  55. putchar(Ch);
  56. Console:: SetCursorPosition (x,y-i);
  57. putchar(Ch);
  58. Thread::Sleep(t);
  59. if(pen==false);
  60. Console :: SetCursorPosition (x-i,y);
  61. putchar(Ch);
  62. Console :: SetCursorPosition (x-i,y);
  63. putchar(Ch);
  64. Console:: SetCursorPosition (x,y-i);
  65. putchar(Ch);
  66. Console:: SetCursorPosition (x,y-i);
  67. putchar(Ch);
  68. Thread::Sleep(t);
  69. }
  70. }
  71.  
  72. int main(array<System::String ^> ^args)
  73. {
  74. Console::Clear();
  75. Console::ForegroundColor=ConsoleColor::Red;
  76. box(5,5,5,200,'*',true);
  77. box2(10,10,6,200,'*',true);
  78. box(5,5,5,200,' ',false);
  79. box2(10,10,6,200,' ',false);
  80.  
  81. Console::ForegroundColor=ConsoleColor::Green;
  82. box(10,5,5,200,'@',true);
  83. box2(15,10,6,200,'@',true);
  84. box(10,5,5,200,' ',false);
  85. box2(15,10,6,200,' ',false);
  86.  
  87. Console::ForegroundColor=ConsoleColor::Blue;
  88. box(15,5,5,200,'$',true);
  89. box2(20,10,6,200,'$',true);
  90. box(15,5,5,200,' ',false);
  91. box2(20,10,6,200,' ',false);
  92.  
  93. Console::ForegroundColor=ConsoleColor::Cyan;
  94. box(20,5,5,200,'%',true);
  95. box2(25,10,6,200,'%',true);
  96. box(20,5,5,200,' ',false);
  97. box2(25,10,6,200,' ',false);
  98.  
  99. Console::ForegroundColor=ConsoleColor::Magenta;
  100. box(25,5,5,200,'^',true);
  101. box2(30,10,6,200,'^',true);
  102. box(25,5,5,200,' ',false);
  103. box2(30,10,6,200,' ',false);
  104.  
  105. Console::ForegroundColor=ConsoleColor::Yellow;
  106. box(30,5,5,200,'=',true);
  107. box2(35,10,6,200,'=',true);
  108. box(30,5,5,200,' ',false);
  109. box2(35,10,6,200,' ',false);
  110.  
  111. Console::ForegroundColor=ConsoleColor::Gray;
  112. box(35,5,5,200,'#',true);
  113. box2(40,10,6,200,'#',true);
  114. box(35,5,5,200,' ',false);
  115. box2(40,10,6,200,' ',false);
  116.  
  117. Console::ForegroundColor=ConsoleColor::DarkCyan;
  118. box(40,5,5,200,'!',true);
  119. box2(45,10,6,200,'!',true);
  120. box(40,5,5,200,' ',false);
  121. box2(45,10,6,200,' ',false);
  122.  
  123. Console::ForegroundColor=ConsoleColor::DarkYellow;
  124. box(45,5,5,200,'&',true);
  125. box2(50,10,6,200,'&',true);
  126. box(45,5,5,200,' ',false);
  127. box2(50,10,6,200,' ',false);
  128.  
  129. Console::ForegroundColor=ConsoleColor::White;
  130. box(50,5,5,200,'+',true);
  131. box2(55,10,6,200,'+',true);
  132. box(50,5,5,200,' ',false);
  133. box2(55,10,6,200,' ',false);
  134.  
  135.  
  136. Console::CursorVisible=false;
  137. Console::ReadLine();
  138.  
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement