Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- using System.IO;
- using Mono.CSharp;
- using Android.Widget;
- using Android.Content;
- using Android.Views.InputMethods;
- using System.Threading.Tasks;
- using NativeUiLib; //This ads the GUI contols. Minor abstractions over Xamarin.Android/Mono.Android
- namespace SORTED
- {
- public static class Program
- {
- public static async void Main()
- {
- var Bolas = "01234567890987654321012345678901234567890123456789";
- string lista = null;
- int[] sf = new int[10];
- int z=0;
- var sort = new char[5]; var bola = new Random();
- var lay1 = new LinearLayout();
- //lay1.Orientation = Android.Widget.Orientation.Vertical;
- var lbl = lay1.AddTextView();
- var valor = lay1.AddEditText(true);
- //var lay2 = new LinearLayout();
- //lay2.Orientation = Android.Widget.Orientation.Horizontal;
- int N = 50000;
- var btn = lay1.AddButton();
- var btn1 = lay1.AddButton();
- var lbl1 = lay1.AddTextView();
- lbl1.SetPadding(4,5,5,0);
- if (valor.Text != "")
- {
- N = Convert.ToInt32(valor.Text);
- }
- string[] sorteo = new string[N];
- lbl.Text = " Xamarin.Forms/Mono.Android/App ";
- btn.Text = " SORTEAR ";
- btn1.Text = " BORRAR ";
- lay1.Show(); Console.Clear();
- //lay2.Show();
- await Task.Delay(300);
- btn.Click += delegate
- {
- if (valor.Text != "")
- {
- N = Convert.ToInt32(valor.Text);
- }
- lista = null;
- for(int j=0; j<N; j++)
- {
- for (int i=0; i < sort.Length; i++)
- {
- sort[i] = Bolas[bola.Next(Bolas.Length)];
- }
- sorteo [j] = new String(sort);
- }
- for(int k=0; k<N; k++)
- {
- lista = lista + sorteo[k] + " ";
- }
- for (int i=0; i<10; i++)
- {
- sf[i]=0; z=0;
- for(int j=0; j<N; j++)
- {
- string x = Convert.ToString(sorteo[j][4]);
- if (x == $"{i}")
- {
- z++;
- }
- }
- sf[i]=z;
- }
- lbl1.Text = $"Terminaciones de 0, 1, 2, 3, 4, 5, 6, 7, 8 y 9 respectivamente:\n {sf[0]},{sf[1]},{sf[2]},{sf[3]},{sf[4]},{sf[5]},{sf[6]},{sf[7]},{sf[8]},{sf[9]}\n\n" + lista;
- };
- btn1.Click += delegate
- {
- lbl1.Text = "";
- valor.Text = "";
- N=0;
- for (int i=0; i<10; i++)
- {
- sf[i]=0;
- }
- };
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement