Advertisement
Guest User

Shit

a guest
Oct 7th, 2015
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.88 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. }
  13. static void CmdProduct1(Stack<char> s1, int x)
  14. {
  15. char cChar;
  16. Stack<char> tempchar = new Stack<char>();
  17.  
  18. while (!s1.IsEmpty())
  19. {
  20. cChar = s1.Pop();
  21.  
  22. for (int i = 0; i < x; i++)
  23. {
  24. Console.Write(cChar + " ");
  25. }
  26. tempchar.Push(cChar);
  27. }
  28. while (!tempchar.IsEmpty())
  29. {
  30. s1.Push(tempchar.Pop());
  31. }
  32. }
  33. static void CmdProduct2(Stack<int> s1)
  34. {
  35. int intLow, intTemp;
  36. Stack<int> tempint = new Stack<int>();
  37.  
  38. intLow = s1.Pop();
  39. tempint.Push(intLow);
  40.  
  41. while (!s1.IsEmpty())
  42. {
  43. intTemp = s1.Pop();
  44. if (intLow > intTemp)
  45. {
  46. intLow = intTemp;
  47. }
  48. tempint.Push(intTemp);
  49. }
  50. while (!tempint.IsEmpty())
  51. {
  52. s1.Push(tempint.Pop());
  53. }
  54. Console.WriteLine("The smallest number is {0}", intLow);
  55. }
  56. static Stack<int> CmdProduct3(Stack<int> stacknumber, Stack<int> stacknumber2)
  57. {
  58. int intTemp, intTemp2;
  59. Stack<int> tempint = new Stack<int>();
  60. Stack<int> tempint2 = new Stack<int>();
  61.  
  62. while (!stacknumber.IsEmpty())
  63. {
  64. intTemp = stacknumber.Pop();
  65. if ( CmdHelpProduct3( stacknumber2, intTemp ) )
  66. {
  67. tempint.Push(intTemp);
  68. }
  69.  
  70. tempint2.Push(intTemp);
  71. }
  72. while (!tempint2.IsEmpty())
  73. {
  74. stacknumber.Push(tempint2.Pop());
  75. }
  76. return tempint;
  77. }
  78. static bool CmdHelpProduct3( Stack<int> stacksnumber, int Number)
  79. {
  80. bool boolHelper = false;
  81. int intTemp;
  82. Stack<int> tempint = new Stack<int>();
  83. while (!stacksnumber.IsEmpty())
  84. {
  85. intTemp = stacksnumber.Pop();
  86. tempint.Push(intTemp);
  87. if( Number == intTemp )
  88. {
  89. boolHelper = true;
  90. }
  91. }
  92. while (!tempint.IsEmpty())
  93. {
  94. stacksnumber.Push(tempint.Pop());
  95. }
  96. return boolHelper;
  97. }
  98. static void CmdProduct4(Stack<int> stacknumber3)
  99. {
  100. int intTemp, intCount = 0;
  101. Stack<int> tempint = new Stack<int>();
  102. while (!stacknumber3.IsEmpty())
  103. {
  104. intTemp = stacknumber3.Pop();
  105. if ((intTemp % 10) == 3)
  106. {
  107. intCount++;
  108. }
  109. tempint.Push(intTemp);
  110. }
  111. while (!tempint.IsEmpty())
  112. {
  113. stacknumber3.Push(tempint.Pop());
  114. }
  115. }
  116. static void CmdProduct4(Stack<int> stacknumbers, Stack<char> stackchars)
  117. {
  118. int intTemp, intTemp2;
  119. Stack<int> tempint = new Stack<int>();
  120. Stack<char> tempchar = new Stack<char>();
  121.  
  122. while (!stackchars.IsEmpty())
  123. {
  124. intTemp = stackchars.Pop();
  125. intTemp2 = stacknumbers.Pop();
  126.  
  127. for( int i = 0; i < intTemp2; i++ )
  128. {
  129. Console.WriteLine("{0}", intTemp);
  130. }
  131. tempchar.Push(intTemp);
  132. tempint.Push(intTemp2);
  133. }
  134. while (!tempint.IsEmpty())
  135. {
  136. stackchars.Push(tempchar.Pop());
  137. stacknumbers.Push(tempint.Pop());
  138. }
  139. }
  140. static Stack<int> CmdProduct5(Stack<int> stacknumber4, Stack<int> stacknumber5)
  141. {
  142. int intTemp, intTemp2;
  143. Stack<int> tempint = new Stack<int>();
  144. Stack<int> tempint2 = new Stack<int>();
  145.  
  146. while (!stacknumber4.IsEmpty())
  147. {
  148. intTemp = stacknumber4.Pop();
  149. if ( CmdHelpProduct3( stacknumber5, intTemp ) )
  150. {
  151. tempint.Push(intTemp);
  152. }
  153.  
  154. tempint2.Push(intTemp);
  155. }
  156. while (!tempint2.IsEmpty())
  157. {
  158. stacknumber4.Push(tempint2.Pop());
  159. }
  160. return tempint;
  161. }
  162. static bool CmdHelpProduct5( Stack<int> stacksnumbers, int Number)
  163. {
  164. bool boolHelper = false;
  165. int intTemp;
  166. Stack<int> tempint = new Stack<int>();
  167. while (!stacksnumbers.IsEmpty())
  168. {
  169. intTemp = stacksnumbers.Pop();
  170. tempint.Push(intTemp);
  171. if( Number != intTemp )
  172. {
  173. boolHelper = true;
  174. }
  175. }
  176. while (!tempint.IsEmpty())
  177. {
  178. stacksnumbers.Push(tempint.Pop());
  179. }
  180. return boolHelper;
  181. }
  182. static void CmdProduct6(Stack<int> stacknumber, Stack<int> stacknumber2)
  183. {
  184. int intTemp, intTemp2;
  185. Stack<int> tempint = new Stack<int>();
  186. Stack<int> tempint2 = new Stack<int>();
  187. Stack<int> tempint3 = new Stack<int>();
  188.  
  189. while (!stacknumber.IsEmpty())
  190. {
  191. intTemp = stacknumber.Pop();
  192. intTemp2 = stacknumber2.Pop();
  193. if (intTemp == intTemp2)
  194. {
  195. tempint.Push(intTemp);
  196. }
  197.  
  198. tempint2.Push(intTemp);
  199. tempint3.Push(intTemp2);
  200. }
  201. while (!tempint2.IsEmpty() && !tempint3.IsEmpty())
  202. {
  203. stacknumber.Push(tempint2.Pop());
  204. stacknumber2.Push(tempint3.Pop());
  205. }
  206. }
  207. static void CmdProduct7(Stack<int> stacknumbermamoca)
  208. {
  209. int intTemp, intSum, intCount;
  210. Stack<int> tempint = new Stack<int>();
  211.  
  212. while (!stacknumber.IsEmpty())
  213. {
  214. intTemp = stacknumbermamoca.Pop();
  215. intSum += intTemp;
  216. intCount++;`
  217.  
  218. tempint.Push(intTemp);
  219. }
  220. Console.WriteLine(" the Avarage is {0}", ( intSum / intCount ));
  221. while (!tempint.IsEmpty())
  222. {
  223. stacknumbermamoca.Push(tempint.Pop());
  224. }
  225. }
  226. }
  227. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement