Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- }
- static void CmdProduct1(Stack<char> s1, int x)
- {
- char cChar;
- Stack<char> tempchar = new Stack<char>();
- while (!s1.IsEmpty())
- {
- cChar = s1.Pop();
- for (int i = 0; i < x; i++)
- {
- Console.Write(cChar + " ");
- }
- tempchar.Push(cChar);
- }
- while (!tempchar.IsEmpty())
- {
- s1.Push(tempchar.Pop());
- }
- }
- static void CmdProduct2(Stack<int> s1)
- {
- int intLow, intTemp;
- Stack<int> tempint = new Stack<int>();
- intLow = s1.Pop();
- tempint.Push(intLow);
- while (!s1.IsEmpty())
- {
- intTemp = s1.Pop();
- if (intLow > intTemp)
- {
- intLow = intTemp;
- }
- tempint.Push(intTemp);
- }
- while (!tempint.IsEmpty())
- {
- s1.Push(tempint.Pop());
- }
- Console.WriteLine("The smallest number is {0}", intLow);
- }
- static Stack<int> CmdProduct3(Stack<int> stacknumber, Stack<int> stacknumber2)
- {
- int intTemp, intTemp2;
- Stack<int> tempint = new Stack<int>();
- Stack<int> tempint2 = new Stack<int>();
- while (!stacknumber.IsEmpty())
- {
- intTemp = stacknumber.Pop();
- if ( CmdHelpProduct3( stacknumber2, intTemp ) )
- {
- tempint.Push(intTemp);
- }
- tempint2.Push(intTemp);
- }
- while (!tempint2.IsEmpty())
- {
- stacknumber.Push(tempint2.Pop());
- }
- return tempint;
- }
- static bool CmdHelpProduct3( Stack<int> stacksnumber, int Number)
- {
- bool boolHelper = false;
- int intTemp;
- Stack<int> tempint = new Stack<int>();
- while (!stacksnumber.IsEmpty())
- {
- intTemp = stacksnumber.Pop();
- tempint.Push(intTemp);
- if( Number == intTemp )
- {
- boolHelper = true;
- }
- }
- while (!tempint.IsEmpty())
- {
- stacksnumber.Push(tempint.Pop());
- }
- return boolHelper;
- }
- static void CmdProduct4(Stack<int> stacknumber3)
- {
- int intTemp, intCount = 0;
- Stack<int> tempint = new Stack<int>();
- while (!stacknumber3.IsEmpty())
- {
- intTemp = stacknumber3.Pop();
- if ((intTemp % 10) == 3)
- {
- intCount++;
- }
- tempint.Push(intTemp);
- }
- while (!tempint.IsEmpty())
- {
- stacknumber3.Push(tempint.Pop());
- }
- }
- static void CmdProduct4(Stack<int> stacknumbers, Stack<char> stackchars)
- {
- int intTemp, intTemp2;
- Stack<int> tempint = new Stack<int>();
- Stack<char> tempchar = new Stack<char>();
- while (!stackchars.IsEmpty())
- {
- intTemp = stackchars.Pop();
- intTemp2 = stacknumbers.Pop();
- for( int i = 0; i < intTemp2; i++ )
- {
- Console.WriteLine("{0}", intTemp);
- }
- tempchar.Push(intTemp);
- tempint.Push(intTemp2);
- }
- while (!tempint.IsEmpty())
- {
- stackchars.Push(tempchar.Pop());
- stacknumbers.Push(tempint.Pop());
- }
- }
- static Stack<int> CmdProduct5(Stack<int> stacknumber4, Stack<int> stacknumber5)
- {
- int intTemp, intTemp2;
- Stack<int> tempint = new Stack<int>();
- Stack<int> tempint2 = new Stack<int>();
- while (!stacknumber4.IsEmpty())
- {
- intTemp = stacknumber4.Pop();
- if ( CmdHelpProduct3( stacknumber5, intTemp ) )
- {
- tempint.Push(intTemp);
- }
- tempint2.Push(intTemp);
- }
- while (!tempint2.IsEmpty())
- {
- stacknumber4.Push(tempint2.Pop());
- }
- return tempint;
- }
- static bool CmdHelpProduct5( Stack<int> stacksnumbers, int Number)
- {
- bool boolHelper = false;
- int intTemp;
- Stack<int> tempint = new Stack<int>();
- while (!stacksnumbers.IsEmpty())
- {
- intTemp = stacksnumbers.Pop();
- tempint.Push(intTemp);
- if( Number != intTemp )
- {
- boolHelper = true;
- }
- }
- while (!tempint.IsEmpty())
- {
- stacksnumbers.Push(tempint.Pop());
- }
- return boolHelper;
- }
- static void CmdProduct6(Stack<int> stacknumber, Stack<int> stacknumber2)
- {
- int intTemp, intTemp2;
- Stack<int> tempint = new Stack<int>();
- Stack<int> tempint2 = new Stack<int>();
- Stack<int> tempint3 = new Stack<int>();
- while (!stacknumber.IsEmpty())
- {
- intTemp = stacknumber.Pop();
- intTemp2 = stacknumber2.Pop();
- if (intTemp == intTemp2)
- {
- tempint.Push(intTemp);
- }
- tempint2.Push(intTemp);
- tempint3.Push(intTemp2);
- }
- while (!tempint2.IsEmpty() && !tempint3.IsEmpty())
- {
- stacknumber.Push(tempint2.Pop());
- stacknumber2.Push(tempint3.Pop());
- }
- }
- static void CmdProduct7(Stack<int> stacknumbermamoca)
- {
- int intTemp, intSum, intCount;
- Stack<int> tempint = new Stack<int>();
- while (!stacknumber.IsEmpty())
- {
- intTemp = stacknumbermamoca.Pop();
- intSum += intTemp;
- intCount++;`
- tempint.Push(intTemp);
- }
- Console.WriteLine(" the Avarage is {0}", ( intSum / intCount ));
- while (!tempint.IsEmpty())
- {
- stacknumbermamoca.Push(tempint.Pop());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement