Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace GameNumberWars
- {
- class Program
- {
- static void Main(string[] args)
- {
- string player1 = Console.ReadLine();
- string player2 = Console.ReadLine();
- string command = Console.ReadLine();
- int point1 = 0;
- int point2 = 0;
- while (command != "End of game")
- {
- int card01 = int.Parse(command);
- int card02 = int.Parse(Console.ReadLine());
- if (card01 > card02)
- {
- point1 += card01 - card02;
- }
- else if (card01 < card02)
- {
- point2 += card02 - card01;
- }
- else
- {
- card01 = int.Parse(Console.ReadLine());
- card02 = int.Parse(Console.ReadLine());
- Console.WriteLine("Number wars!");
- if (card01 > card02)
- {
- Console.WriteLine($"{player1} is winner with {point1} points");
- }
- else
- {
- Console.WriteLine($"{player2} is winner with {point2} points");
- }
- break;
- }
- command = Console.ReadLine();
- }
- if (command == "End of game")
- {
- Console.WriteLine($"{player1} has {point1} points");
- Console.WriteLine($"{player2} has {point2} points");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment