/*
Learning C#
by Jesse Liberty
Publisher: O'Reilly
ISBN: 0596003765
*/
using System;
public class SwitchValues
{
static void Main()
{
const int Democrat = 0;
const int Republican = 1;
const int Progressive = 2;
// hard wire to Republican
int myChoice = Republican;
// switch on the value of myChoice
switch (myChoice)
{
case Democrat:
Console.WriteLine("You voted Democratic.");
break;
case Republican:
Console.WriteLine("You voted Republican.");
break;
case Progressive:
Console.WriteLine("You voted Progressive.");
break;
}
Console.WriteLine("Thank you for voting.");
}
}
|