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

  • 相关阅读:
    作业5:扒开系统调用的三层皮(下) 20135115臧文君
    课本学习笔记2:第五章 20135115臧文君
    Linux及安全实践二
    Linux内核分析 期中总结
    Linux内核分析08
    Linux内核分析07
    Linux内核分析06
    Linux内核分析 05
    Linux内核分析04
    Linux内核分析 03
  • 原文地址:https://www.cnblogs.com/lyli/p/4361625.html
Copyright © 2011-2022 走看看