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~)

  • 相关阅读:
    二维数组求矩形最大子数组和
    关于返回一个整数数组中最大子数组的和的问题(详细版)
    学习进度第三周
    人月神话阅读笔记03
    团队开发项目-NABCD模型
    第七周学习总结
    人月神话阅读笔记01
    第六周学习总结
    大道至简阅读笔记03
    结对开发地铁查询
  • 原文地址:https://www.cnblogs.com/lyli/p/4361625.html
Copyright © 2011-2022 走看看