Exemple #1
0
        static void TopVotes(Vote[] votes, int[] totals)
        {
            int TotalVotes = Vote.GetTotalVotes();

            int ComPercent = (totals[0] / TotalVotes) * 100;
            int DemPercent = (totals[1] / TotalVotes) * 100;
            int FasPercent = (totals[2] / TotalVotes) * 100;


            if (ComPercent > 50)
            {
                Console.WriteLine("Communists won by " + ComPercent + " %");
            }
            else if (DemPercent > 50)
            {
                Console.WriteLine("Democrats won by " + DemPercent + " %");
            }
            else if (FasPercent > 50)
            {
                Console.WriteLine("Facists won by " + FasPercent + " %");
            }
            else
            {
                Console.WriteLine("No Party got over 50%");
            }
        }