Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication3
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             string player1, player2;
  13.             bool Done = false;
  14.             int Number;
  15.  
  16.             Console.WriteLine("Podaj imie gracza 1:  ");
  17.             player1 = Console.ReadLine();
  18.  
  19.             Console.WriteLine("Podaj imie gracza 2:   ");
  20.             player2 = Console.ReadLine();
  21.  
  22.  
  23.             Random RandomObj = new Random();
  24.             int x = RandomObj.Next(1000);
  25.  
  26.             string player = player1;
  27.  
  28.             while (!Done)
  29.             {
  30.                 player = player == player1 ? player2 : player1;
  31.                 Console.WriteLine(player + ", go,go!");
  32.                 Number = Convert.ToInt32(Console.ReadLine());
  33.  
  34.                 if (x > Number)
  35.                 {
  36.                     Console.WriteLine("Liczba jest wieksza niz podana");
  37.                 }
  38.                 else if (x < Number)
  39.                 {
  40.                     Console.WriteLine("liczba jest mniejsza niz podana");
  41.                 }
  42.                 else
  43.                 {
  44.                     Console.WriteLine("dobrze. wygral gracz" + player);
  45.                     Done = true;
  46.                 }
  47.                                
  48.             }
  49.              Console.ReadLine();
  50.         }  
  51.        
  52.         }
  53.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement