Beispiel #1
0
 public void Test_Decomp()
 {
     char[] d = Decompose.Find('\x2000').ToCharArray();
     Assert.NotNull(d);
     Assert.Equals(1, d.Length);
     Assert.Equals('\x0020', d[0]);
 }
 public void Test1()
 {
     Decompose d = new Decompose();
     long n = 11;
     Assert.AreEqual("1 2 4 10", d.decompose(n));
     Assert.AreEqual("1 3 5 8 49", d.decompose(50));
 }
 public void Test_Decomp()
 {
     char[] d = Decompose.Find('\x2000');
     Assertion.AssertNotNull(d);
     Assertion.AssertEquals(1, d.Length);
     Assertion.AssertEquals('\x0020', d[0]);
 }
Beispiel #4
0
    public static void Main()
    {
        Decompose ob = new Decompose();
        int       i; double f;

        i = ob.parts(10.125, out f);
        Console.WriteLine("Целая часть числа равна " + i);
        Console.WriteLine("Дробная часть числа равна " + f);
    }
Beispiel #5
0
        static void Main(string[] args)
        {
            // https://www.codewars.com/kata/54eb33e5bc1a25440d000891 solution by TobiH

            Decompose d = new Decompose();

            Console.WriteLine(d.decompose(11));
            Console.ReadLine();
        }
Beispiel #6
0
    static void Main()
    {
        Decompose ob = new Decompose();
        int       i;
        double    f;

        i = ob.GetParts(10.125, out f);
        Console.WriteLine("Integer portion is " + i);
        Console.WriteLine("Fractional part is " + f);
    }
Beispiel #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("Введите число : ");
            string input = Console.ReadLine();
            double n     = Convert.ToDouble(input);
            int    whole;
            double frac;

            whole = Decompose.GetParts(n, out frac);

            Console.WriteLine("Целая часть = {0}; дробная часть числа = {1}", whole, frac);
        }
Beispiel #8
0
        private void Decomp(StringBuilder result)
        {
            int    len;
            string ex;

            // Decompose
            for (int i = 0; i < result.Length; i++)
            {
                ex = Decompose.Find(result[i]);
                if (ex == null)
                {
                    continue;
                }

                result[i] = ex[0];
                len       = ex.Length - 1;
                if (len > 0)
                {
                    result.Insert(i + 1, ex.ToCharArray(1, ex.Length - 1));
                    i += len;
                }
            }
        }
	private bool seenOnce = false; //If player is seen once
	
	//Awake() instead of Start() for script referencing
	void Awake(){
		decompScript = GameObject.Find ("A* Controller").GetComponent<Decompose> ();
	}
Beispiel #10
0
    static void Main()
    {
        Perem val1 = new Perem(10, 20);
        int   a = 35, b = 49;

        //передача параметра типа значение по значению
        Console.WriteLine("Передача параметра типа значение (по значению):");
        Console.WriteLine("a={0}; b={1}", a, b);
        val1.ChangeZnach(a, b);
        Console.WriteLine("a={0}; b={1}", a, b);
        Console.WriteLine();

        //передача параметра типа класс по ссылке
        Console.WriteLine("Передача параметра типа класса (по ссылке):");
        val1.Show();
        val1.ChangeREf(val1);
        val1.Show();
        Console.WriteLine();

        //передача параметра типа значение по ссылке
        Console.WriteLine("Передача параметра типа значение (по ссылке):");
        Console.WriteLine("a={0}; b={1}", a, b);
        val1.ChangeZnachByRef(ref a, ref b);
        Console.WriteLine("a={0}; b={1}", a, b);
        Console.WriteLine();

        //используем передачу параметров по ссылке
        //для обмена значениями переменных
        Console.WriteLine("Обмен значениями:");
        Console.WriteLine("a={0}; b={1}", a, b);
        val1.Swap(ref a, ref b);
        Console.WriteLine("a={0}; b={1}", a, b);
        Console.WriteLine();

        //получим целую и дробную часть по отдельности
        double myVal = 12.123;

        Console.WriteLine("myVal={0}", myVal);
        Decompose d = new Decompose();
        double    doublePart;
        int       intPart = d.Decomp(myVal, out doublePart);

        Console.WriteLine("intPart={0}; doublePart={1}", intPart, doublePart);
        Console.WriteLine();

        //поиск минимального и максимального общего множителя
        int  m = 35, n = 49;
        int  least, gratest;
        Num  Temp   = new Num();
        bool status = Temp.CommonMnog(m, n, out least, out gratest);

        Console.WriteLine("Поиск общих множителей:");
        Console.WriteLine("m={0}; n={1}", m, n);
        Console.WriteLine("least={0}; gratest={1}", least, gratest);
        Console.WriteLine();

        //передача объектов типа класса по ссылке
        Console.WriteLine("Смена объектов под ссылками:");
        REfSwap p = new REfSwap(17, 43);
        REfSwap q = new REfSwap(235, 411);

        p.Show();
        q.Show();
        p.Swap(ref p, ref q);
        p.Show();
        q.Show();
        Console.WriteLine();

        //переменное количество параметров в методе
        Console.WriteLine("Переменное количество параметров в методе:");
        Min qw = new Min();

        int[] array = new int[27];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = i;
        }
        int minVal = qw.Minimal(array);

        Console.WriteLine("Минимальное значение: {0}", minVal);
    }
Beispiel #11
0
	Decompose world; //Decompose script reference

	//Instead of Start() for script referencing
	void Awake() {
		world = GetComponent<Decompose>();
	}
Beispiel #12
0
	Decompose decompScript; //Decompose script reference
	
	//Instead of Start() for script referencing
	void Awake() {
		//Gets script from this object
		decompScript = GetComponent<Decompose> ();
	}