Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace GameOfNames
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- int MaxPoints = int.MinValue;
- string firstPlayername = "";
- string secondPlayername = "";
- int pointsFirstplayer = 0;
- int pointsSecondplayer = 0;
- while (input != "Stop")
- {
- for (int i = 0; i < input.Length; i++)
- {
- int num = int.Parse(Console.ReadLine());
- if (num == input[i])
- {
- pointsFirstplayer += 10;
- }
- else
- {
- pointsFirstplayer += 2;
- }
- }
- if (pointsFirstplayer >= MaxPoints)
- {
- MaxPoints = pointsFirstplayer;
- firstPlayername = input;
- }
- input = Console.ReadLine();
- if (input == "Stop")
- {
- break;
- }
- for (int i = 0; i < input.Length; i++)
- {
- int num = int.Parse(Console.ReadLine());
- if (num == input[i])
- {
- pointsSecondplayer += 10;
- }
- else
- {
- pointsSecondplayer += 2;
- }
- secondPlayername = input;
- if (input == "Stop")
- {
- break;
- }
- }
- input = Console.ReadLine();
- }
- if (pointsFirstplayer > pointsSecondplayer)
- {
- Console.WriteLine($"The winner is {firstPlayername} with {pointsFirstplayer} points!");
- }
- else if (pointsFirstplayer < pointsSecondplayer)
- {
- Console.WriteLine($"The winner is {secondPlayername} with {pointsSecondplayer} points!");
- }
- else if (pointsFirstplayer == pointsSecondplayer)
- {
- Console.WriteLine($"The winner is {secondPlayername} with {pointsSecondplayer} points!");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment