zoukankan      html  css  js  c++  java
  • 2.0 Exercise of Basic Statements

    After I coded HelloWorld last week, I'm going to update some codes using basic statements of C# this time.

    • Variables(Easy! So no more explanation here ~)

    • Enumerations

    Remember to cast the enumerated constant, explicitly, to its underlying type(int), when the value of it is wanted. I tried following codes to see the different output.

    (codes)

    (output)

     

    • Branching Statements - Switch

    In this case, keep in mind that, add break; at the end of each case. Also, maybe it's not a good choice to use goto statement.

    (Simple Switch exercise)

    As for the reason I underline the statement above, when I first typed that short statement, I missed the space between case and 2; (just like case2;), then, of course, it doesn't work. Maybe it seems foolish, but being careful never hurts! By the way, when there is nothing special to do in a case like case2;, it's ok to omit  break;.

    (Here comes the output)

    • Iteration Statements - Foreach

    (codes)

    I think it's quite easy when you understand how it works.

    (I got the output after I'd assigned "Still Hello World" to args[].)

    ENDing Word:

    This time, I post statements either new or a little more important (in my opinion ~), though, they look simple, once again, being careful never hurts!

    -----------ENDs & To Be Continued

    (Ah! I almost forgot to refer that I Finally make my Visual Studio 2013 Pro with update 4 work! CONGRATULATION to me then~)

  • 相关阅读:
    CF359B Permutation
    CF859C Pie Rules
    Contest 156
    Contest 155
    Range Module
    python-环境
    Git 使用
    Contest 154
    生命是一种长期而持续的累积过程
    Contest 153
  • 原文地址:https://www.cnblogs.com/lyli/p/4361625.html
Copyright © 2011-2022 走看看