Example #1
0
 /// <summary>
 /// Creates an array of doubles
 /// </summary>
 public static double[] GetDoubleArray(int t = -1)
 {
     if (t == -1)
     {
         t = RequestInt("Quantos elementos tem o Array?", true);
     }
     double[] a = new double[t];
     for (int i = 0; i < t; i++)
     {
         double d = InputRequest.RequestDouble("Introduza um Número");
         a.SetValue(d, i);
     }
     return(a);
 }
Example #2
0
 /// <summary>
 /// Creates an array of strings
 /// </summary>
 public static string[] GetStrArray(int t = -1)
 {
     if (t == -1)
     {
         t = RequestInt("Quantos elementos tem o Array?", true);
     }
     string[] a = new String[t];
     for (int i = 0; i < t; i++)
     {
         var s = InputRequest.RequestString("Escreva algo: ");
         a[i] = s;
     }
     return(a);
 }
Example #3
0
        /// <summary>
        /// Creates an list of doubles
        /// </summary>
        public static List <double> GetDoubleList(int t = -1)
        {
            if (t == -1)
            {
                t = RequestInt("Quantos elementos tem a Lista?", true);
            }
            var l = new List <double>();

            for (int i = 0; i < t; i++)
            {
                var n = InputRequest.RequestDouble("Introduza um Número");
                l.Add(n);
            }
            return(l);
        }
Example #4
0
        /// <summary>
        /// Creates an list of strings
        /// </summary>
        public static List <string> GetStrList(int t = -1)
        {
            if (t == -1)
            {
                t = RequestInt("Quantos elementos tem a Lista?", true);
            }
            List <string> l = new List <string>();

            for (int i = 0; i < t; i++)
            {
                var s = InputRequest.RequestString("Escreva algo: ");
                l.Add(s);
            }
            return(l);
        }
Example #5
0
 /// <summary>
 /// Creates an array of ints
 /// </summary>
 public static int[] GetIntArray(int t = -1)
 {
     if (t == -1)
     {
         t = RequestInt("Quantos elementos tem o Array?", true);
     }
     string[] a = new String[t];
     for (int i = 0; i < t; i++)
     {
         var s = InputRequest.RequestString("Introduza um Número Inteiro");
         a.SetValue(s, i);
     }
     int[] b = new int[t];
     for (int i = 0; i < a.Length; i++)
     {
         string v = a.GetValue(i).ToString();
         b.SetValue(Conversoes.ConverterStringParaInt(v), i);
     }
     return(b);
 }