Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace P06_NameGame
- {
- class P06_NameGame
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- int bestPoints = 0;
- string winner = "";
- while ("Stop" != name)
- {
- int currentPoints = 0;
- for (int i = 0; i < name.Length; i++)
- {
- int number = int.Parse(Console.ReadLine());
- if (number == name[i])
- {
- currentPoints += 10;
- }
- else
- {
- currentPoints += 2;
- }
- }
- if (currentPoints >= bestPoints)
- {
- bestPoints = currentPoints;
- winner = name;
- }
- name = Console.ReadLine();
- }
- Console.WriteLine($"The winner is {winner} with {bestPoints} points!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement