Facebook
From Innocent Wigeon, 5 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 200
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace kolejkaStos
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.         }
  15.     }
  16.  
  17.     class Kolejka : ASiD
  18.     {
  19.         int[] values;
  20.         int valuesLength;
  21.         public Kolejka(int n)
  22.         {
  23.             valuesLength = n;
  24.             generateVals();
  25.         }
  26.  
  27.         public void generateVals()
  28.         {
  29.             Random rand = new Random();
  30.             for (int i = 0; i < valuesLength; i++)
  31.             {
  32.                 values[i] = rand.Next(-30, 30);
  33.             }
  34.         }
  35.  
  36.         public void Push(int x)
  37.         {
  38.            
  39.         }
  40.  
  41.         public int Pop()
  42.         {
  43.             return values[valuesLength - 1];
  44.         }
  45.  
  46.         public void Show()
  47.         {
  48.             Console.WriteLine("Values in queue: ");
  49.             foreach (int value in values)
  50.             {
  51.                 Console.Write(value + ' ');
  52.             }
  53.         }
  54.  
  55.         public int Length()
  56.         {
  57.             return valuesLength;
  58.         }
  59.     }
  60.  
  61.     class Stos
  62.     {
  63.  
  64.     }
  65.  
  66.     interface ASiD
  67.     {
  68.         void Push(int x);
  69.         int Pop();
  70.         int Length();
  71.         void Show();
  72.     }
  73. }