online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
using System; public class Program { // ------------------------- // Globals // ------------------------- static Random random_generator = new Random(); // ------------------------- // Subprograms // ------------------------- static int[] roll() { int[] dice = { 0, 0 }; dice[0] = random_generator.Next(1, 7); dice[1] = random_generator.Next(1, 7); return dice; } static int points(int[] dice) { if (dice[0] == 1 && dice[1] == 1) { return -1; } else if (dice[0] == 1 || dice[1] == 1) { return 0; } else { return dice[0] + dice[1]; } } static void play_game() { int[] score = { 0, 0 }; int player = 0; bool new_player = true; int total = 0; bool turn_end = false; string choice = ""; while (score[0] <= 100 && score[1] <= 100) { if (new_player) { Console.WriteLine(); Console.WriteLine("------------------------------------"); Console.WriteLine($"Player {player + 1} it's your turn"); Console.WriteLine($"Your score is currently {score[player]}"); total = 0; new_player = false; turn_end = false; } Console.WriteLine("Press Enter to roll the dice."); Console.ReadLine(); int[] dice = roll(); int result = points(dice); Console.WriteLine($"You rolled a {dice[0]} and {dice[1]}"); if (result > 0) { Console.WriteLine($"You scored {result}"); total += result; Console.WriteLine($"Your total is {total}"); choice = ""; while (choice != "y" && choice != "n") { Console.Write("Do you want to continue y/n? :"); choice = Console.ReadLine(); } if (choice == "n") { score[player] = score[player] + total; turn_end = true; } } else { Console.WriteLine("Oh no, that's a pig out!"); turn_end = true; } if (turn_end) { Console.WriteLine("Press Enter to hand the dice to the next player."); Console.ReadLine(); player = (player + 1) % 2; new_player = true; } } } // ------------------------- // Main program // ------------------------- static void Main() { play_game(); } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue