コード例 #1
0
ファイル: exercice2.cs プロジェクト: COLVERTYETY/tda2
 public region(string _name, string _prefet, Commune _cheflieu)
 {
     this.name     = _name;
     this.prefet   = _prefet;
     this.chefLieu = _cheflieu;
     this.myCommunes.Add(_cheflieu);
 }
コード例 #2
0
ファイル: exercice2.cs プロジェクト: COLVERTYETY/tda2
 public region(string _name, string _prefet, int nofcommune)
 {
     this.name   = _name;
     this.prefet = _prefet;
     for (int _ = 0; _ <= nofcommune; _++)
     {
         myCommunes.Add(new Commune());
     }
     this.chefLieu = myCommunes[0];
 }
コード例 #3
0
ファイル: exercice2.cs プロジェクト: COLVERTYETY/tda2
 public region(string _name, string _prefet, Commune _cheflieu, List <Commune> liste)
 {
     this.name       = _name;
     this.prefet     = _prefet;
     this.chefLieu   = _cheflieu;
     this.myCommunes = liste;
     if (!this.appartenance(this.chefLieu))
     {
         this.myCommunes.Add(this.chefLieu);
     }
 }
コード例 #4
0
ファイル: exercice2.cs プロジェクト: COLVERTYETY/tda2
        public bool appartenance(Commune other)
        {
            bool res = false;

            for (int i = 0; i < this.myCommunes.Count; i++)
            {
                if (this.myCommunes[i].equals(other))
                {
                    res = true;
                    break;
                }
            }
            return(res);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: COLVERTYETY/tda2
        static void Main(string[] args)
        {
            Commune paris = new Commune("Paris", 75, "FRance", 2200000, "Hidalgo");
            Commune rouen = new Commune("rouen", 76, "FRance", 111000, "Robert");

            paris.Nhabitant = 2220000;
            string s = paris.tostring();
            bool   b = paris.equals(rouen);

            Console.WriteLine(s);
            Console.ReadLine();
            Console.Clear();
            Commune marly       = new Commune("Marly");
            region  IledeFrance = new region("Ile de FRance", "prefet", new Commune("Paris"));

            IledeFrance.Add(new Commune("VErsaille"));
            IledeFrance.Add(marly);
            Console.WriteLine(IledeFrance.appartenance(new Commune()));
            Console.WriteLine(IledeFrance.appartenance(marly));
            Console.ReadLine();
            IledeFrance.disp();
            Console.ReadLine();
            Console.Clear();
            IledeFrance.alphasort();
            IledeFrance.disp();
            Console.ReadLine();
            Console.Clear();
            Console.WriteLine(IledeFrance.tostring());
            Console.WriteLine(IledeFrance.popTotal());
            Console.ReadLine();
            Console.Clear();
            region megapole = new region("big", "unprefet", 100);

            megapole.disp();
            Console.ReadLine();
            Console.Clear();
            megapole.alphasort();
            megapole.disp();
            Console.ReadLine();
        }
コード例 #6
0
ファイル: exercice2.cs プロジェクト: COLVERTYETY/tda2
 public void Add(Commune acomm)
 {
     this.myCommunes.Add(acomm);
 }
コード例 #7
0
ファイル: exercice1.cs プロジェクト: COLVERTYETY/tda2
 public static bool equalstatic(Commune A, Commune B)
 {
     return(A.equals(B));
 }
コード例 #8
0
ファイル: exercice1.cs プロジェクト: COLVERTYETY/tda2
 public bool equals(Commune other)
 {
     return(this.nhabitant == other.nhabitant);
 }