Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3.  
  4. namespace SLAB6
  5. {
  6.     class MainClass
  7.     {
  8.         public static void Main (string[] args)
  9.         {
  10.             string oneStr, twoStr;
  11.             oneStr = Console.ReadLine ();
  12.             twoStr = Console.ReadLine ();
  13.             Console.WriteLine ("Поиск строки в строке с начала = " + oneStr.IndexOf(twoStr));
  14.             Console.WriteLine ("Поиск строки в строке с конца = " + oneStr.LastIndexOf(twoStr));
  15.  
  16.  
  17.             oneStr = Console.ReadLine ();
  18.             twoStr = Console.ReadLine ();
  19.             string[] Pieces = oneStr.Split(twoStr[0]);
  20.             foreach (string str2 in Pieces) {
  21.                 Console.WriteLine (str2);
  22.             }
  23.  
  24.  
  25.             int a = 38;
  26.             Console.WriteLine("a = {0:d4}", a);
  27.             int b = 255;
  28.             Console.WriteLine("b = {0:X}", b);
  29.             int c = 255;
  30.             Console.WriteLine("c ={0:x}", c);
  31.             double pi = 3.1415926;
  32.             Console.WriteLine("pi = {0:f2}", pi);
  33.             double d=1003.214;
  34.             Console.WriteLine("d={0:c}", d);
  35.             double e=213.1;
  36.             Console.WriteLine("e={0:e}", e);
  37.             DateTime dt = new DateTime(2018, 3, 9, 16, 5, 7, 123);
  38.             Console.WriteLine("{0:y yy yyy yyyy}", dt);
  39.             Console.WriteLine("{0:d dd ddd dddd}", dt);
  40.             Console.WriteLine("{0:M MM MMM MMMM}", dt);
  41.  
  42.  
  43.             StringBuilder MyStringBuilder = new StringBuilder("Hello World!");
  44.             MyStringBuilder.Append(" What a beautiful day.");
  45.             Console.WriteLine(MyStringBuilder);
  46.  
  47.  
  48.             string str = Console.ReadLine ();
  49.             int len = str.Length;
  50.             int oldLen = len;
  51.             len = len / 2;
  52.             int i = 0;
  53.             char temp;
  54.             char[] chars = str.ToCharArray ();
  55.             while (i < len) {
  56.                 temp = str [i];
  57.                 chars [i] = chars [oldLen - i -1];
  58.                 chars [oldLen - i - 1] = temp;
  59.                 i++;
  60.             }
  61.             Console.WriteLine (chars);
  62.         }
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement