Opgepast! Het lijkt erop dat je Dodona gebruikt binnen een andere webpagina waardoor mogelijk niet alles goed werkt. Laat dit weten aan de lesgever zodat die het probleem kan oplossen door een instelling in de leeromgeving aan te passen. Ondertussen kan je op deze link klikken om Dodona te openen in een nieuw venster.
Opgepast! De pagina kon niet volledig ingeladen worden, waarschijnlijk door een netwerkprobleem. Het kan zijn dat niet alle functionaliteit beschikbaar is. Probeer de pagina te verversen.
- Level 9 - Two-dimension arrays and lists
- Rainfall collector
- Journey log
- Snakes and ladders
- Quote of the day
- Word game
- Grade book
- Checkout
- Missiles
- Noughts and crosses
Log in om je oplossingen te testen.
// Journey log program
using System;
using System.Collections.Generic;
using System.IO;
class Submission
{
// -------------------------
// Globals
// -------------------------
static List<List<string>> book = new List<List<string>>();
// -------------------------
// Subprograms
// -------------------------
static void add_chapter()
{
book.Add(new List<string>());
}
static void add_story(int chapter, string entry)
{
book[chapter].Add(entry);
}
static void output()
{
int log = 1;
for (int chapter = 0; chapter < book.Count; chapter++)
{
foreach (string entry in book[chapter])
{
Console.WriteLine($"Log {log}: {entry}");
log++;
}
}
}
// -------------------------
// Main program
// -------------------------
public static void Main(string[] args)
{
add_chapter();
add_story(0, "I find myself alone on a strange world, unequipped and in danger. I have no memory of how I got here, no sense of a before.");
add_story(0, "My Exosuit at least seems to know what it's doing, and I am not dead yet...");
add_chapter();
add_story(1, "I received a set of mysterious coordinates from an unknown source.");
add_story(1, "I followed the signal, and found the wreckage of an abandoned starship.");
add_story(1, "There was little to be gained from the wreck, but the distress beacon contained the hailing frequency labelled 'ARTEMIS'.");
output();
}
}