Advertisement
AvengersAssemble

Untitled

Feb 22nd, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.78 KB | None | 0 0
  1. using System;
  2. using Unit4.CollectionsLib;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Lab_18_02
  7. {
  8.     class Program
  9.     {
  10.         public static bool CheckPolydrom(int n)
  11.         {
  12.             string st = n.ToString();
  13.             for (int i = 0; i < st.Length / 2; i++)
  14.                 if (st[i] != st[st.Length - i - 1])
  15.                     return false;
  16.             return true;
  17.         }
  18.  
  19.         public static bool NodePolyndrom(Node<int> n)
  20.         {
  21.             Stack<int> s = new Stack<int>();
  22.             if (n == null)
  23.                 return false;
  24.             while (n!= null && n.GetInfo() != 0)
  25.             {
  26.                 s.Push(n.GetInfo());
  27.                 n = n.GetNext();
  28.             }
  29.             if (n == null)
  30.                 return false;
  31.             n = n.GetNext();
  32.             while (n != null)
  33.             {
  34.                 if (s.Pop() != n.GetInfo())
  35.                     return false;
  36.                 if (!CheckPolydrom(n.GetInfo()))
  37.                     return false;
  38.                 n = n.GetNext();
  39.             }
  40.            
  41.             return true;
  42.         }
  43.  
  44.         static void Main(string[] args)
  45.         {
  46.             DateTime t;
  47.             while (true)
  48.             {
  49.                 t = DateTime.Now;
  50.                 t = t.AddMinutes(-44);
  51.                 if (t.Hour < 10)
  52.                     Console.Write("0");
  53.                 Console.Write(t.Hour + ":");
  54.                 if (t.Minute < 10)
  55.                     Console.Write("0");
  56.                 Console.Write(t.Minute + ":");
  57.                 if (t.Second < 10)
  58.                     Console.Write("0");
  59.                 Console.WriteLine(t.Second);
  60.                 System.Threading.Thread.Sleep(1000);
  61.                 Console.Clear();
  62.             }
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement