Advertisement
kadoel

Visual Studio C# mencari zodiak denagn substring

Apr 16th, 2012
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.38 KB | None | 0 0
  1. /*
  2.  
  3. Name : mencari zodiak dengan substring
  4.  
  5. Source by : kadeol noesa
  6.  
  7. */
  8.  
  9. using System;
  10.  
  11. using System.Collections.Generic;
  12.  
  13. using System.Linq;
  14.  
  15. using System.Text;
  16.  
  17. namespace kadoel
  18.  
  19. {
  20.  
  21.     class Program
  22.  
  23.     {
  24.  
  25.         static void Main(string[] args)
  26.  
  27.         {
  28.         String lahir;
  29.             String tanggal;
  30.             String bulan;
  31.             String pil;
  32.             int day;
  33.             int month;
  34.         ulang :
  35.             Console.Write("Masukkan tanggal Lahir : ");
  36.             lahir = Console.ReadLine();
  37.             tanggal = lahir.Substring(0, 2);
  38.             day = Convert.ToInt32(tanggal);
  39.             bulan = lahir.Substring(3, 2);
  40.             month = Convert.ToInt32(bulan);
  41.  
  42.             if (month == 01)
  43.             {
  44.                 if ((day >= 01) && (day <= 19))
  45.                 {
  46.                     Console.Write("Anda Berzodiak CAPRICORN");
  47.  
  48.                 }
  49.                 else if ((day >= 20) && (day <= 31))
  50.                 {
  51.                     Console.Write("Anda Berzodiak AQUARIUS");
  52.                 }
  53.             }
  54.  
  55.             if (month == 02)
  56.             {
  57.                 if ((day >= 01) && (day <= 18))
  58.                 {
  59.                     Console.Write("Anda Berzodiak AQUARIUS");
  60.                 }
  61.                 else if ((day >= 19) && (day <= 29))
  62.                 {
  63.                     Console.Write("Anda Berzodiak PISCES");
  64.                 }
  65.             }
  66.             if (month == 03)
  67.             {
  68.                 if ((day >= 01) && (day <= 20))
  69.                 {
  70.                     Console.Write("Anda Berzodiak PISCES");
  71.                 }
  72.                 else if ((day >= 21) && (day <= 31))
  73.                 {
  74.                     Console.Write("Anda Berzodiak ARIES");
  75.                 }
  76.             }
  77.             if (month == 04)
  78.             {
  79.                 if ((day >= 01) && (day <= 20))
  80.                 {
  81.                     Console.WriteLine("Anda Berzodiak ARIES");
  82.                 }
  83.                 else if ((day >= 21) && (day <= 30))
  84.                 {
  85.                     Console.Write("Anda Berzodiak TAURUS");
  86.                 }
  87.             }
  88.             if (month == 05)
  89.             {
  90.                 if ((day >= 01) && (day <= 20))
  91.                 {
  92.                     Console.Write("Anda Berzodiak TAURUS");
  93.                 }
  94.                 else if ((day >= 21) && (day <= 31))
  95.                 {
  96.                     Console.Write("Anda Berzodiak GEMINI");
  97.                 }
  98.             }
  99.             if (month == 06)
  100.             {
  101.                 if ((day >= 01) && (day <= 20))
  102.                 {
  103.                     Console.Write("Anda Berzodiak GEMINI");
  104.                 }
  105.                 else if ((day >= 21) && (day <= 30))
  106.                 {
  107.                     Console.Write("Anda Berzodiak CANCER");
  108.                 }
  109.             }
  110.             if (month == 07)
  111.             {
  112.                 if ((day >= 01) && (day <= 21))
  113.                 {
  114.                     Console.Write("Anda Berzodiak CANCER");
  115.                 }
  116.                 else if ((day >= 22) && (day <= 31))
  117.                 {
  118.                     Console.Write("Anda Berzodiak LEO");
  119.                 }
  120.             }
  121.             if (month == 08)
  122.             {
  123.                 if ((day >= 01) && (day <= 20))
  124.                 {
  125.                     Console.Write("Anda Berzodiak LEO");
  126.                 }
  127.                 else if ((day >= 21) && (day <= 31))
  128.                 {
  129.                     Console.Write("Anda Berzodiak VIRGO");
  130.                 }
  131.             }
  132.             if (month == 09)
  133.             {
  134.                 if ((day >= 01) && (day <= 22))
  135.                 {
  136.                     Console.Write("Anda Berzodiak VIRGO");
  137.                 }
  138.                 else if ((day >= 23) && (day <= 30))
  139.                 {
  140.                     Console.Write("Anda Berzodiak LIBRA");
  141.                 }
  142.             }
  143.             if (month == 10)
  144.             {
  145.                 if ((day >= 01) && (day <= 22))
  146.                 {
  147.                     Console.Write("Anda Berzodiak LIBRA");
  148.                 }
  149.                 else if ((day >= 23) && (day <= 31))
  150.                 {
  151.                     Console.Write("Anda Berzodiak SCORPIO");
  152.                 }
  153.             }
  154.             if (month == 11)
  155.             {
  156.                 if ((day >= 01) && (day <= 22))
  157.                 {
  158.                     Console.Write("Anda Berzodiak SCORPIO");
  159.                 }
  160.                 else if ((day >= 23) && (day <= 30))
  161.                 {
  162.                     Console.Write("Anda Berzodiak SAGITARIUS");
  163.                 }
  164.             }
  165.             if (month == 12)
  166.             {
  167.                 if ((day >= 1) && (day <= 20))
  168.                 {
  169.                     Console.Write("Anda Berzodiak SAGITARIUS");
  170.                 }
  171.                 else if ((day >= 21) && (day <= 31))
  172.                 {
  173.                     Console.Write("Anda Berzodiak CAPRICORN");
  174.                 }
  175.             }
  176.            
  177.             Console.WriteLine();
  178.                 ulng:
  179.             Console.Write("Apakah anda Ingin Mencoba lagi [Y/N] ? ");
  180.             pil = Console.ReadLine();
  181.            
  182.             if (pil=="y" || pil=="Y")
  183.             {
  184.                 Console.Clear();
  185.                 goto ulang;
  186.             }
  187.            
  188.             if (pil =="n" || pil == "N")
  189.             {
  190.                 Console.Clear();
  191.                 Console.Write("TERIMAKASI");
  192.             }
  193.            
  194.             else
  195.             {
  196.                 Console.Clear();
  197.                 goto ulng;
  198.             }
  199.             Console.ReadLine();
  200.         }
  201.     }
  202. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement