Exemple #1
0
        public static attrezzo prezzomassimo(attrezzo[] eleattrezzi, int n)
        {
            int      x             = default(int);
            decimal  prezzomassimo = default(decimal);
            attrezzo attrezzomax   = default(attrezzo);

            prezzomassimo = eleattrezzi[0].prezzo;
            attrezzomax   = eleattrezzi[0];

            while (x < n)
            {
                if (eleattrezzi[x].prezzo > prezzomassimo)
                {
                    prezzomassimo = eleattrezzi[x].prezzo;
                    attrezzomax   = eleattrezzi[x];
                }
                x = x + 1;
            }
            return(attrezzomax);
        }
Exemple #2
0
        public static void ordinaquantità(attrezzo[] eleattrezzi, int n)
        {
            attrezzo temporaneo = default(attrezzo);
            int      x          = default(int);
            int      y          = default(int);

            while (x < n)
            {
                y = x + 1;

                while (y < n)
                {
                    if (eleattrezzi[x].quantità > eleattrezzi[y].quantità)
                    {
                        temporaneo     = eleattrezzi[x];
                        eleattrezzi[x] = eleattrezzi[y];
                        eleattrezzi[y] = temporaneo;
                    }
                    y = y + 1;
                }
                x = x + 1;
            }
        }
Exemple #3
0
        public static void ordinacategoria(attrezzo[] eleattrezzi, int n)
        {
            attrezzo temporaneo = default(attrezzo);
            int      x          = default(int);
            int      y          = default(int);

            while (x < n)
            {
                y = x + 1;

                while (y < n)
                {
                    if (string.Compare(eleattrezzi[x].categoria, eleattrezzi[y].categoria) > 0)
                    {
                        temporaneo     = eleattrezzi[x];
                        eleattrezzi[x] = eleattrezzi[y];
                        eleattrezzi[y] = temporaneo;
                    }
                    y = y + 1;
                }
                x = x + 1;
            }
        }