Advertisement
Guest User

AiSD1_1

a guest
Sep 18th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 KB | None | 0 0
  1. using System;
  2.  
  3. namespace AiSD1
  4. {
  5.     class Program
  6.     {
  7.         void PUSH(int x, int[] S)
  8.         {
  9.             int n = 0;
  10.             while(S[n] != -1)
  11.             {
  12.                 n++;
  13.             }
  14.             S[n] = x;
  15.         }
  16.         bool POP(int[] S)
  17.         {
  18.             if (!ISEMPTY(S))
  19.             {
  20.                 int n = 0;
  21.                 while (S[n] != -1)
  22.                 {
  23.                     n++;
  24.                 }
  25.                 S[n] = -1;
  26.                 return true;
  27.             }
  28.             else
  29.             {
  30.                 return false;
  31.             }
  32.         }
  33.         bool ISEMPTY(int[] S)
  34.         {
  35.             if(S[0] == -1)
  36.             {
  37.                 return true;
  38.             }
  39.             else
  40.             {
  41.                 return false;
  42.             }
  43.         }
  44.         void CLAER(int[] S)
  45.         {
  46.             int n = 0;
  47.             while (S[n] != -1)
  48.             {
  49.                 n++;
  50.                 S[n] = -1;
  51.             }
  52.         }
  53.         int TOP(int[] S)
  54.         {
  55.             int n = 0;
  56.             while (S[n] != -1)
  57.             {
  58.                 n++;
  59.             }
  60.             return S[n - 1];
  61.         }
  62.         static void Main(string[] args)
  63.         {
  64.             Console.WriteLine("Hello World!");
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement