码迷,mamicode.com
首页 > 其他好文 > 详细

基础语句

时间:2014-07-31 09:48:06      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:os   io   for   ar   line   amp   res   har   

基础语句  #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

基础语句,布布扣,bubuko.com

基础语句

标签:os   io   for   ar   line   amp   res   har   

原文地址:http://www.cnblogs.com/huweijun/p/3879902.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!