Advertisement
mmayoub

DiceGame.cs

Dec 22nd, 2021
1,074
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace PointExercise
  6. {
  7.     class DiceGame
  8.     {
  9.         public static void Main(string[] args)
  10.         {
  11.             Die d1, d2;
  12.  
  13.             d1 = new Die();
  14.             d2 = new Die();
  15.  
  16.             d1.Roll();
  17.             d2.Roll();
  18.             int i;
  19.             //for (int i = 0; d1.getNum()!=6 || d2.getNum()!=6 ; i++) {
  20.             //for (int i = 0; !(d1.getNum() == 6 &&  d2.getNum() == 6); i++)
  21.             for (i = 1; (d1.getNum() == 6 && d2.getNum() == 6) == false; i++)
  22.             {
  23.                 d1.Roll();
  24.                 d2.Roll();
  25.                 Console.WriteLine("{0} , {1}", d1.getNum(), d2.getNum());
  26.             }
  27.  
  28.             Console.WriteLine("rolls count = {0}", i);
  29.         }
  30.     }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement