https://m.facebook.com/story.php ... amp;id=153080620724
應該係咁複製內容到剪貼板
代碼:
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
namespace CSharp_Shell
{
public class Program
{
private static int trump;
private static int biden;
public static int voteBiden
{
get
{
return biden;
}
set
{
biden += value;
}
}
public static int voteTrump
{
get
{
return trump;
}
set
{
biden += value;
}
}
public static void Main()
{
bool c = true;
while(c)
{
Console.WriteLine("\nselect vote: 1=Trump 2=Biden");
int candid;
int.TryParse(Console.ReadLine(),out candid);
Console.WriteLine("\nvotes to add: ");
int v;
if (candid == 1)
{
int.TryParse(Console.ReadLine(),out v);
voteTrump = v;
}
else if (candid == 2)
{
int.TryParse(Console.ReadLine(),out v);
voteBiden = v;
}
else
c = false;
Console.WriteLine("Trump has " + voteTrump.ToString() + "");
Console.WriteLine("Biden has " + voteBiden.ToString() + ""
);
}
}
}
}