1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| using System;
namespace Project3
{
class Class
{
// La fonction
// "mot" c'est ce qu'on cherche
// "p" c'est la liste des chaînes i.e. "l'ensemble"
public static bool IsInSet(string mot,params string[] p)
{
foreach (string s in p) if (string.Compare(mot,s,true)==0)
return true;
return false;
}
[STAThread]
static void Main(string[] args)
{
//
// TODO: Ajouter du code ici pour démarrer l'application
//
if (IsInSet("toty","titi","tata","Toto"))
Console.WriteLine("INSET");
else Console.WriteLine("NOT IN SET");
Console.ReadLine(); // pause clavier
}
}
} |
Partager