Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Stack as a queue
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { Stack<int> stack1 = new Stack<int>(); Stack<int> stack2 = new Stack<int>(); push(stack1, 6); push(stack1, 5); push(stack1, 4); top(stack1); foreach(int i in stack1) { Console.WriteLine(i); } stack2.Push(pop(stack1)); stack2.Push(pop(stack1)); stack2.Push(pop(stack1)); foreach(int i in stack2) { Console.WriteLine(i); } } public static void push(Stack<int> stk1, int num) { stk1.Push(num); } public static int pop(Stack<int> stk1) { if(stk1 != null) return(stk1.Pop()); return 0; } public static void top(Stack<int> stk1) { if(stk1 != null) stk1.Peek(); } } }
run
|
edit
|
history
|
help
0
Custom long date
Queue with Queue Data type
Find smallest and largest in unsorted array
Delegate test lambda
Print 2D Array
asdfrgthyjuhtgrfed
Move 2 ushort to 1 int
Ejemplo
help sending dataGrid Rows to Access Table.
1