Skip to Content
Beginning Visual C# 2012 Programming
book

Beginning Visual C# 2012 Programming

by Karli Watson, Jacob Vibe Hammer, Jon Reid, Morgan Skinner, Daniel Kemper, Christian Nagel
December 2012
Beginner
912 pages
26h 32m
English
Wrox
Content preview from Beginning Visual C# 2012 Programming

A

Exercise Solutions

There are no exercises in Chapters 1 and 2.

CHAPTER 3 SOLUTIONS

Exercise 1

super.smashing.great

Exercise 2

b), as it starts with a number, and e), as it contains a full stop.

Exercise 3

No, there is no theoretical limit to the size of a string that may be contained in a string variable.

Exercise 4

The * and / operators have the highest precedence here, followed by +, <<, and finally +=. The precedence in the exercise can be illustrated using parentheses as follows:

resultVar += (((var1 * var2) + var3) << (var4 / var5));

Exercise 5

static void Main(string[] args)
{
   int firstNumber, secondNumber, thirdNumber, fourthNumber;
   Console.WriteLine("Give me a number:");
   firstNumber = Convert.ToInt32(Console.ReadLine());
   Console.WriteLine("Give me another number:");
   secondNumber = Convert.ToInt32(Console.ReadLine());
   Console.WriteLine("Give me another number:");
   thirdNumber = Convert.ToInt32(Console.ReadLine());
   Console.WriteLine("Give me another number:");
   fourthNumber = Convert.ToInt32(Console.ReadLine());
   Console.WriteLine("The product of {0}, {1}, {2}, and {3} is {4}.",
                 firstNumber, secondNumber, thirdNumber, fourthNumber,
                 firstNumber * secondNumber * thirdNumber * fourthNumber);
}

Note that Convert.ToInt32() is used here, which isn’t covered in the chapter.

CHAPTER 4 SOLUTIONS

Exercise 1

(var1 > 10) ^ (var2 > 10)
[AU: wrong sign]

Exercise 2

static void Main(string[] args) { bool numbersOK = false; double var1, var2; var1 = 0; var2 = 0; while (!numbersOK) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Beginning C# 7 Programming with Visual Studio 2017

Beginning C# 7 Programming with Visual Studio 2017

Benjamin Perkins, Jacob Vibe Hammer, Jon D. Reid
Beginning C# 6.0 Programming with Visual Studio 2015

Beginning C# 6.0 Programming with Visual Studio 2015

Benjamin Perkins, Jacob Vibe Hammer, Jon D. Reid
Beginning Visual C# 2010

Beginning Visual C# 2010

Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon Reid, Morgan Skinner

Publisher Resources

ISBN: 9781118331941Purchase book