首页 > 代码库 > 基础语句

基础语句

基础语句  #region  switch  case         //    int Number=char.Parse(Console.ReadLine());         //    switch (Number)         //{         //    case 1:         //        Console.WriteLine("1");         //        break;         //    case 2:         //        Console.WriteLine("2");         //        break;         //    default:         //        Console.WriteLine("3");         //        break;         //}

        //Console.ReadKey();         #endregion         #region  while         //int i = 0;         //while (i <10)         //{         //    i++;         //}         //Console.WriteLine(i);         //Console.ReadKey();         #endregion         #region do  while         //int i = 0;         //do         //{         //    i++;         //}         //while (i < 10);         //Console.WriteLine(i);         //Console.ReadKey();         #endregion         #region if else         //int Number = Int32.Parse(Console.ReadLine());         //if (Number > 10)         //    Console.Write("hallo");         //else         //    if (Number == 10)         //        Console.Write("not well");         //    else if (Number < 10)         //        Console.Write("good");         #endregion         #region  for         //Console.Write("数值");         //int name = Int32.Parse(Console.ReadLine());         //for (int Number = 0; Number < name; Number++)         //{         //    if (Number / 10 == 10)         //    {         //        Number -= 5;         //    }

        //    else         //    {         //        Number += 5;         //    }         //    Number = Number * 2;         //    Console.WriteLine("{0}", Number);         //}

        #endregion         #region 递归         /*int name;             for (int i=0; i<=30; i++)             {                  name =wife(i);                  Console.WriteLine(name.ToString());                              }             Console.ReadKey();       }         public static int wife(int end)         {             if (end <=0)             {                 return 0;             }             else if (end>0&&end<=2)             {                 return 1;             }             else             {                 return wife(end - 1) + wife(end - 2);             }         }*/         #endregion

        #region  加减乘除         //    double Number1;         //    double Number2;         //    Console.WriteLine("运算的两个数");         //    Number1 = Convert.ToDouble(Console.ReadLine());         //    Number2 = Convert.ToDouble(Console.ReadLine());         //    Console.WriteLine("Sum:{0} Minus:{1} Ride:{2} Except:{3}",         //                        Sum(Number1, Number2), Minus(Number1, Number2),         //                        Ride(Number1, Number2), Except(Number1, Number2));

        //    Console.ReadKey();         //}

        //private static double Sum(double paramvalue1, double paramvalue2)         //  {         //    double result;         //    result = paramvalue1 + paramvalue2;         //    return result;         //  }         //private static double Minus(double paramValue1, double paramValue2)         //{         //    double result;         //    result = paramValue1 - paramValue2;         //    return result;         //}         //  private static double Ride(double paramValue1, double paramValue2)         //{         //    double result;         //    result = paramValue1 * paramValue2;         //    return result;         //}         //private static double Except(double paramValue1, double paramValue2)         //{         //    double result;         //    result = paramValue1 / paramValue2;         //    return result;         #endregion         #region    5050         //int sum=0;         //for (int i = 0; i <=100; i++)         //{         //    sum += i;         //}         // Console.WriteLine(sum);         // Console.ReadKey();         #endregion         #region 1*1+2*2+N*N         //       Console.WriteLine("初始值|");         //       int name=Int32.Parse(Console.ReadLine());         //       int sum=0;         //       for(int team = 1; team <=name; team++)         //       {         //           sum += team * team;         //       }

        //       Console.Write(sum);         //       Console.ReadKey();         #endregion         #region 奇偶加减         //bool team = true;         //int Number = 0;         //Console.WriteLine("输入一个整数");         //int sum = Int32.Parse(Console.ReadLine());         //for (int i = 1; i <= sum; i++)         //{         //    if (team)         //    {         //        Number += i;         //    }         //     else         //    {         //        Number -= i;         //    }         //    team = !team;         //}         //Console.Write(Number);         //Console.ReadKey();         #endregion         #region 九九乘法表         // for (int i = 1; i <=9; i++)         //{         //     for (int j = 1; j <= i; j++)         //    {         //        Console.Write("{0}*{1}={2}\t", i, j, i * j);         //    }         //    Console.WriteLine();         //}         //Console.ReadKey();         #endregion