Advertisement
csaki

Untitled

Oct 10th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.62 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace _3_név
  7. {
  8.      class Program
  9.      {
  10.           static void Main(string[] args)
  11.           {
  12.                     while (true)
  13.                     {
  14.                               Console.Clear();
  15.                Console.WriteLine("1. 3 név if-ekkel");
  16.                Console.WriteLine("3. első 100 szám");
  17.                Console.WriteLine("4. első 100 szám közül a párosak");
  18.                Console.WriteLine("5. első 100 szám közül a páratlanok");
  19.                Console.WriteLine("6. számok kiiratása 2 oszlopba");
  20.                Console.WriteLine("7. számok és betűk kiiratása 2 oszlopba");
  21.  
  22.                int s = int.Parse(Console.ReadLine());
  23.                switch (s)
  24.                {
  25.                          case 1:
  26.  
  27.                                    Console.WriteLine("Írjon be 3 nevet: ");
  28.                                    string x = Console.ReadLine();
  29.                                    string y = Console.ReadLine();
  30.                                    string z = Console.ReadLine();
  31.  
  32.                                    int a = x.Length;
  33.                                    int b = y.Length;
  34.                                    int c = z.Length;
  35.                                    Console.WriteLine("A nevek hossza csökkenő sorrendben: ");
  36.                                    if (c < b && b < a)
  37.                                    {
  38.                                              Console.WriteLine("{0}, {1}, {2}", x, y, z);
  39.                                    }
  40.                                    if (b < c && c < a)
  41.                                    {
  42.                                              Console.WriteLine("{0}, {1}, {2}", x, z, y);
  43.                                    }
  44.                                    if (c < a && a < b)
  45.                                    {
  46.                                              Console.WriteLine("{0}, {1}, {2}", y, x, z);
  47.                                    }
  48.                                    if (a < c && c < b)
  49.                                    {
  50.                                              Console.WriteLine("{0}, {1}, {2}", y, z, x);
  51.                                    }
  52.                                    if (b < a && a < c)
  53.                                    {
  54.                                              Console.WriteLine("{0}, {1}, {2}", z, x, y);
  55.                                    }
  56.                                    if (a < b && b < c)
  57.                                    {
  58.                                              Console.WriteLine("{0}, {1}, {2}", z, y, x);
  59.                                    }
  60.                                    Console.ReadKey();
  61.                                    break;
  62.  
  63.                          case 2:
  64.  
  65.                                    Console.Write("Írjon be 3 nevet: ");
  66.                                    string x1 = Console.ReadLine();
  67.                                    string y1 = Console.ReadLine();
  68.                                    string z1 = Console.ReadLine();
  69.  
  70.                                    int a1 = x1.Length;
  71.                                    int b1 = y1.Length;
  72.                                    int c1 = z1.Length;
  73.  
  74.                                    if (c1 < b1 && b1 < a1)
  75.                                    {
  76.                                              Console.WriteLine("{0}, {1}, {2}", x1, y1, z1);
  77.                                    }
  78.                                    if (b1 < c1 && c1 < a1)
  79.                                    {
  80.                                              Console.WriteLine("{0}, {1}, {2}", x1, z1, y1);
  81.                                    }
  82.                                    if (c1 < a1 && a1 < b1)
  83.                                    {
  84.                                              Console.WriteLine("{0}, {1}, {2}", y1, x1, z1);
  85.                                    }
  86.                                    if (a1 < c1 && c1 < b1)
  87.                                    {
  88.                                              Console.WriteLine("{0}, {1}, {2}", y1, z1, x1);
  89.                                    }
  90.                                    if (b1 < a1 && a1 < c1)
  91.                                    {
  92.                                              Console.WriteLine("{0}, {1}, {2}", z1, x1, y1);
  93.                                    }
  94.                                    if (a1 < b1 && b1 < c1)
  95.                                    {
  96.                                              Console.WriteLine("{0}, {1}, {2}", z1, y1, x1);
  97.                                    }
  98.                                    Console.ReadKey();
  99.                                    break;
  100.  
  101.                          case 3:
  102.  
  103.                                    for (int i = 0; i < 100; i++)
  104.                                    {
  105.                                              Console.WriteLine(i);
  106.                                    }
  107.                                    Console.ReadKey();
  108.                                    break;
  109.  
  110.                          case 4:
  111.  
  112.                                    for (int i = 0; i < 100; i += 2)
  113.                                    {
  114.                                              Console.WriteLine(i);
  115.                                    }
  116.                                    Console.ReadKey();
  117.                                    break;
  118.  
  119.                          case 5:
  120.  
  121.                                    for (int i = 1; i < 100; i += 2)
  122.                                    {
  123.                                              Console.WriteLine(i);
  124.                                    }
  125.                                    Console.ReadKey();
  126.                                    break;
  127.  
  128.                          case 6:
  129.  
  130.                                    for (int i = 0; i < 11; i++)
  131.                                    {
  132.                                              Console.WriteLine("{0}:{1}", i, i * 2);
  133.                                    }
  134.                                    Console.ReadKey();
  135.                                    break;
  136.  
  137.                          case 7:
  138.                                    int k = 0;
  139.                                    for (char i = 'a'; i <= 'z'; i++)
  140.                                    {
  141.                                              
  142.                                              Console.WriteLine("{0} : {1}", k, i);
  143.                                              k++;
  144.                                    }
  145.                                    Console.ReadKey();
  146.                                    break;
  147.                }
  148.                }
  149.           }
  150.      }
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement