online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
// Notebook program using System; using System.Collections.Generic; public class Program { // ------------------------- // Subprograms // ------------------------- static int get_note_number() { bool valid_input = false; int note_number = -1; while (!valid_input) { Console.Write("Note number: "); note_number = Convert.ToInt32(Console.ReadLine()); if (note_number >= 0 && note_number < 10) { valid_input = true; } else { Console.WriteLine("Invalid input. Enter 0-9."); } } return note_number; } static void add_note(string[] notebook) { int index = get_note_number(); Console.Write("Enter the note: "); string note = Console.ReadLine(); notebook[index] = note; } static void clear_notes(string[] notebook) { string choice = ""; while (choice != "y" && choice != "n") { Console.Write("Are you sure you want to delete all notes? y/n :"); choice = Console.ReadLine(); } if (choice == "y") { for (int index = 0; index < notebook.Length; index++) { notebook[index] = ""; } } } static void order_notes(string[] notebook) { Array.Sort(notebook); } static void show_notebook(string[] notebook) { for (int index = 0; index < notebook.Length; index++) { Console.WriteLine($"{index} : {notebook[index]}"); } } // Menu choices static void menu(string[] notebook) { Console.WriteLine(); Console.WriteLine("a. Add note"); Console.WriteLine("c. Clear notebook"); Console.WriteLine("o. Order notes"); Console.Write(":"); string choice = Console.ReadLine(); switch (choice) { case "a": add_note(notebook); break; case "c": clear_notes(notebook); break; case "o": order_notes(notebook); break; } } // ------------------------- // Main program // ------------------------- static void Main() { string[] notebook = new string[10]; while (true) { show_notebook(notebook); menu(notebook); } } }

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