Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication50
- {
- class Program
- {
- int x;
- static string[] thestack = new string[10];
- static int pointer = -1;
- static void Main(string[] args)
- {
- int x =0;
- while (x < 1)
- {
- int input;
- Console.WriteLine(" 1) Add New User");
- Console.WriteLine(" 2) Check latest player ");
- Console.WriteLine(" 3) Remove last player ");
- input = Convert.ToInt32(Console.ReadLine());
- if (input == 1)
- {
- Console.WriteLine("Please enter player name");
- push(Console.ReadLine());
- }
- if (input == 2)
- {
- Console.WriteLine("The latest player is ... " + peek());
- }
- if (input == 3)
- {
- Console.WriteLine("Removing the cheat!" + pop());
- }
- Console.WriteLine("Would you like to continue?");
- string decision = Console.ReadLine();
- if (decision == "yes")
- {
- x = 0;
- }
- else if (decision == "no")
- {
- x = 1;
- }
- }
- }
- static string pop()
- {
- string item;
- item = thestack[pointer];
- thestack[pointer] = "";
- pointer--;
- return item;
- }
- static string peek()
- {
- return thestack[pointer];
- }
- static void push (string item)
- {
- pointer++;
- thestack[pointer] = item;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement