Level 3 - Condition controlled repetitions 0 of 9 activities solved
  1. Capital city Not yet solved
  2. Car value Not yet solved
  3. Adder Not yet solved
  4. Compound interest Not yet solved
  5. Valid month Not yet solved
  6. Cashpoint Not yet solved
  7. Square root Not yet solved
  8. PIN Not yet solved
  9. Measurements Not yet solved
Next series Assessment point - Levels 1-3
Level 3 - Condition controlled repetitions

Capital city

Sign in to hand in your solution and get feedback.

// Capital city program using System; class Submission { // ------------------------- // Subprograms // ------------------------- static bool check_answer(string country, string city) { if (country == "England" && city == "London") { return true; } if (country == "France" && city == "Paris") { return true; } else { return false; } } static void capital_cities() { bool correct = false; // Ask for first capital city until correct answer given while (!correct) { string city = Console.ReadLine(); correct = check_answer("England", city); } correct = false; while (!correct) { string city = Console.ReadLine(); correct = check_answer("France", city); } } // ------------------------- // Main program // ------------------------- public static void Main(string[] args) { capital_cities(); Console.WriteLine("The quiz is complete."); } }