Example #1
0
        static void AfficherBestScore(List <Metaux> metauxList)
        {
            int plusGrand = 0;
            int pos       = 0;

            for (int i = 0; i < metauxList.Count; i++)
            {
                Metaux metaux = metauxList[i]; // Il faut le sortir de sa liste pour pouvoir changer sa variable
                metaux.pointage = Math.Abs(metauxList[i].resistance - 5) + Math.Abs(metauxList[i].fusion - 5) + Math.Abs(metauxList[i].poids - 5) + Math.Abs(metauxList[i].conductibilite - 5);
                metauxList[i]   = metaux;
                tabPointage[i]  = metauxList[i].pointage;
                //Console.WriteLine(tabPointage[i]);
                // IL EST SENSÉ FONCTIONNER, mais le premier pointage est toujours dans le positif, jamais dans le positif
            }

            for (int i = 1; i < metauxList.Count; i++)
            {
                int old = (i - 1);
                if (tabPointage[i] > tabPointage[old])
                {
                    plusGrand = metauxList[i].resistance;
                    pos       = i;
                }
            }
            Console.WriteLine("Le métal ayant le meilleur socre est le métal #" + (pos + 1) + ", qui est le " + metauxList[pos].type);
        }
Example #2
0
        static void AfficherWorstResis(List <Metaux> metauxList)
        {
            int plusPetit = 0;
            int pos       = 0;

            for (int i = 0; i < metauxList.Count; i++)
            {
                Metaux metaux = metauxList[i]; // Il faut le sortir de sa liste pour pouvoir changer sa variable
                metaux.pointage = Math.Abs(metauxList[i].resistance - 5);
                metauxList[i]   = metaux;
                tabPointage[i]  = metauxList[i].pointage;
            }

            for (int i = 1; i < metauxList.Count; i++)
            {
                int old = (i - 1);
                if (tabPointage[i] > tabPointage[old])
                {
                    plusPetit = tabPointage[i];
                    pos       = i;
                }
            }
            Console.WriteLine("Le métal ayant la pire résistance est le métal #" + (pos + 1) + ", qui est le " + metauxList[pos].type);
            // IL EST SENSÉ FONCTIONNER, mais le premier pointage est toujours dans le positif, jamais dans le positif
        }
Example #3
0
        static void Main(string[] args)
        {
            bool quitter = false;  int somme = 0; double moyenne = 0;

            Metaux[] tabMetaux = new Metaux[4];
            tabMetaux[0] = new Metaux("Fer", 7, 9, 4, 3);
            tabMetaux[1] = new Metaux("Cuivre", 4, 8, 8, 2);
            tabMetaux[2] = new Metaux("Plomb", 1, 3, 7, 2);
            tabMetaux[3] = new Metaux("Zinc", 2, 5, 3, 6);
            while (quitter != true)
            {
                AfficherMenu();
                int choix = Convert.ToInt32(Console.ReadLine());
                switch (choix)
                {
                case 1: AfficherMetalPireResistance(tabMetaux); break;

                case 2: afficherMeilleurScore(tabMetaux, somme, moyenne); break;

                case 3: AfficherSiMetauxExisteAvecPointFusionPlus8(tabMetaux); break;

                case 4:; break;

                case 5: quitter = true; break;
                }
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            Metaux[] tabmetaux = new Metaux[4];
            tabmetaux[0] = new Metaux("Fer", 7, 9, 4, 3);
            tabmetaux[1] = new Metaux("Cuivre", 4, 8, 8, 2);
            tabmetaux[2] = new Metaux("Plomb", 1, 3, 7, 2);
            tabmetaux[3] = new Metaux("Zinc", 2, 5, 3, 6);
            AfficherListeMetaux(ref tabmetaux);
            AfficherMenu();
            int choixMenu = Convert.ToInt32(Console.ReadLine());

            switch (choixMenu)
            {
            case 1: AfficherMResistance(ref tabmetaux); break;

            case 2: AfficherMScore(ref tabmetaux); break;

            case 3: AfficherSiConductivite6(ref tabmetaux); break;

            case 4: CreerMetaux(ref tabmetaux); break;

            case 5:; break;

            default: Console.WriteLine("Cette option n'est pas valide, veuillez réessayer"); break;
            }
            Console.ReadKey();
        }
Example #5
0
        static void Main(string[] args)
        {
            bool finProgramme = false;

            tabMetaux[0] = new Metaux("Fer", 7, 9, 4, 3);
            tabMetaux[1] = new Metaux("Cuivre", 4, 8, 8, 2);
            tabMetaux[2] = new Metaux("Plomb", 1, 3, 7, 2);
            tabMetaux[3] = new Metaux("Zinc", 2, 5, 3, 6);


            while (finProgramme == false)
            {
                AfficherMenu();
                int choixMenu = Convert.ToInt32(Console.ReadLine());
                switch (choixMenu)
                {
                case 1: PireResistance(); break;

                case 2: meilleurScore(); break;

                case 3: metauxPlusDe8(); break;

                case 4: creerAlliage(); break;

                case 5: finProgramme = true; break;

                default: Console.WriteLine("Entrer un choix existant"); break;
                }
            }
        }