Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _04._Game_Number_Wars
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string firstPlayerName = Console.ReadLine();
- string secondPlayerName = Console.ReadLine();
- int fPPoint = 0, sPPoint = 0;
- while (true)
- {
- string comand = Console.ReadLine();
- if (comand == "End of game")
- {
- Console.WriteLine($"{firstPlayerName} has {fPPoint} points");
- Console.WriteLine($"{secondPlayerName} has {sPPoint} points");
- break;
- }
- int fCardPlayer = int.Parse(comand);
- int sCardPlayer = int.Parse(Console.ReadLine());
- if (fCardPlayer > sCardPlayer)
- {
- fPPoint += (fCardPlayer - sCardPlayer);
- }
- else if (sCardPlayer > fCardPlayer)
- {
- sPPoint += (sCardPlayer - fCardPlayer);
- }
- else
- {
- Console.WriteLine("Number wars!");
- fPPoint = 0;
- sPPoint = 0;
- fCardPlayer = int.Parse(Console.ReadLine());
- sCardPlayer = int.Parse(Console.ReadLine());
- if (fCardPlayer > sCardPlayer)
- {
- fPPoint += (fCardPlayer - sCardPlayer);
- Console.WriteLine($"{firstPlayerName} is winner with {fPPoint} points");
- }
- else if (sCardPlayer > fCardPlayer)
- {
- sPPoint += (sCardPlayer - fCardPlayer);
- Console.WriteLine($"{secondPlayerName} is winner with {sPPoint} points");
- }
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement