using System; namespace MNS // Note: actual namespace depends on the project name. { internal class Program { static void Main(string[] args) { //Afficher un mot dans un tableau de mots string[] mots = { "ACAB", "Communisme", "Anarchisme", "Rouge", "Noir" }; Console.WriteLine(mots[2]); int[] notes = { 17, 18, 15, 14, 10 }; Console.WriteLine(MoyenneTableau(notes)); Console.WriteLine(NomMonstreAleatoire()); } public static int SommeTableau(int[] tableau) { int ARenvoyer = 0; for (int i = 0; i < tableau.Length; i++) { ARenvoyer += tableau[i]; } return ARenvoyer; } public static int MoyenneTableau(int[] tableau) { return SommeTableau(tableau) / tableau.Length; } public static string NomMonstreAleatoire() { string ARenvoyer = ""; string[] nomsMonstres = { "Gobelin", "Zombie", "Dragon", "Orc", "Troll", "Elfe noir", "Chimère", "Banshee", "Harpie", "Gorgone", "Manticore", "Minotaure", "Satyre"}; string[] adjectifsMonstres = { "enragé", "magique", "maléfique", "démoniaque", "brutal" , "infect", "visqueux", "maudit", "putride", "ténébreux", "corrompu"}; Random r = new Random(); int nombreAleatoireNom = r.Next(0, nomsMonstres.Length); Thread.Sleep(100); int nombreAleatoireAdjectif = r.Next(0, adjectifsMonstres.Length); ARenvoyer = nomsMonstres[nombreAleatoireNom] + " " + adjectifsMonstres[nombreAleatoireAdjectif]; return ARenvoyer; } } }