Team LiB
Previous Section Next Section

Exercises

  1. Research Microsoft's C# Language Tour web site at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cscon/html/vclrfgettingstarted_pg.asp

    Cite any advantages or features of C# not mentioned in this chapter.

  2. Explore the Microsoft .NET Framework home page at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/netfxanchor.asp

    Remember that C# can make use of all of the libraries and other capabilities provided by the .NET Framework.

  3. Using a for loop and a continue statement, create a code snippet that will write the even numbers from 2 to 10 to the console.

  4. Using what you know about defining blocks of code and proper indentation technique, make the following code snippet more readable:

            int count = 0;
            for (int j = 0; j < 2; j++) {
            count = j;
            for (int k = 0; k < 3; k++)
            count++;
            Console.WriteLine("count = " + count);
            }
    
  5. Compare what you've learned about C# so far to another programming language that you are already familiar with. What is similar about the two languages? What is different?

  6. Given these initial variable declarations and value assignments:

            int a = 1;
            int b = 1;
            int c = 1;
    

    evaluate the following expression:

          ((((c++ + --a) * b) != 2) && true)
    

Team LiB
Previous Section Next Section