Advertisement
DrAungWinHtut

Luck in CS

Apr 6th, 2022
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace NewTools2
  12. {
  13.     public partial class frmNewTools2 : Form
  14.     {
  15.         public frmNewTools2()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void btnShowDate_Click(object sender, EventArgs e)
  21.         {
  22.             DateTime dtBirthday = dtpDate.Value;
  23.             MessageBox.Show("Your Birthday is " + dtBirthday.Day.ToString() + "\\" + dtBirthday.Month.ToString() + "\\" + dtBirthday.Year.ToString());
  24.             int iLuck = dtBirthday.Day + dtBirthday.Month + dtBirthday.Year;
  25.             iLuck = iLuck % 7;
  26.             string sLuck = "unknown";
  27.             switch(iLuck )
  28.             {
  29.                 case 0: sLuck = "ok";break;
  30.                 case 1: sLuck = "not ok";break;
  31.                 case 2: sLuck = "happy";break;
  32.                 case 3: sLuck = "hungry"; break;
  33.                 case 4: sLuck = "angry"; break;
  34.                 case 5: sLuck = "slippy"; break;
  35.                 case 6: sLuck = "sleepy"; break;              
  36.             }
  37.             txtLuck.Text = sLuck;
  38.            
  39.  
  40.         }
  41.     }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement