1 / 2
Dec 2021

Nie mogę przejść czwartego sędziego, pomoże ktoś ?
Wyczytałem, że błąd może być ze znakiem null ale nie mam pojęcia jak to naprawić.

  • created

    Dec '21
  • last reply

    Dec '21
  • 1

    reply

  • 355

    views

  • 1

    user

  • 1

    link

zero błędów a i tak nie przechodzi ;/

using System;

namespace FR_05_02_MocHasla
{
class Program
{
static void Main(string[] args)
{
int iteracja;
var n = Console.ReadLine();
if (n != null)
{
iteracja = int.Parse(n);

            for (int i = 0; i < iteracja; i++)
            {

                string haslo = Console.ReadLine();

                if (haslo.Length >= 8 && Test(haslo))
                {

                    Console.WriteLine(haslo);


                }


            }
        }

        

        
    }
    

   public static bool checkBigLetter(char c)
    {
        return c >= 'A' && c <= 'Z';
    }

    public static bool checkSmallLetter(char c)
    {
        return c >= 'a' && c <= 'z';
    }

   public static bool checkNumber(char c)
    {
        return c >= '0' && c <= '9';
    }

   public static bool checkSpecialChar(char c)
    {
        if (checkNumber(c) || checkSmallLetter(c) || checkBigLetter(c) )
        {
            return false;
        }
        else
        {
            return true;
        }
    }

    public static bool Test(string zdane)
    {
        
        bool bigLetter = false, smallLetter = false, number = false, specialChar = false;
        for (int i = 0; i < zdane.Length; i++)
        {
            char c = zdane[i];
            bigLetter |= checkBigLetter(c);
            smallLetter |= checkSmallLetter(c);
            number |= checkNumber(c);
            specialChar |= checkSpecialChar(c);
        }
        return bigLetter && smallLetter && number && specialChar;
    }


}

}