Esempio n. 1
0
        static void Main(string[] args)
        {
            int[][] matriz;
            int     casoPrueba = 0;

            int[]  sizeMatriz = null;
            String lineAux    = null;
            char   delimiter  = ' ';

            String[] sizeM   = null;
            String   route   = "soldados.in";
            file     entrada = new file(route);

            entrada.openFile();
            lineAux    = entrada.getLine();
            casoPrueba = Int32.Parse(lineAux);
            for (int i = 0; i < casoPrueba; i++)
            {
                lineAux       = entrada.getLine();
                sizeM         = lineAux.Split(delimiter);
                sizeMatriz    = new int[2];
                sizeMatriz[0] = Int32.Parse(sizeM[0]);
                sizeMatriz[1] = Int32.Parse(sizeM[1]);
                matriz        = new int[sizeMatriz[0]][];
                for (int j = 0; j < sizeMatriz[0]; j++)
                {
                    matriz[j] = new int[sizeMatriz[1]];
                }
                sizeM = null;
                for (int j = 0; j < matriz.Length; j++)
                {
                    lineAux = entrada.getLine();
                    sizeM   = lineAux.Split(delimiter);
                    for (int k = 0; k < matriz[j].Length; k++)
                    {
                        matriz[j][k] = Int32.Parse(sizeM[k]);
                    }
                }
                SoladadosPerdidos(matriz);
                matriz = null;
            }
            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //string path = "E:/first file.txt";
            //string[] arg = new string[0];
            //arg[0] = path;
            file   obj1 = new file();
            string choice;
            string nameofstudent, idofstudent, studentid;
            string cont;
            string filepath = "E:/first file.txt";

            do
            {
                Console.WriteLine(" ");
                Console.WriteLine("************************");
                Console.WriteLine("Please select from menu:");
                Console.WriteLine("************************");
                Console.WriteLine("Press '1' to Add student");
                Console.WriteLine("Press '2' to Search for student BY name");
                Console.WriteLine("Press '3' to Search for student BY ID");
                Console.WriteLine("Press '4' to Delete student record");
                Console.WriteLine("Press '5' to Mark attendance");
                Console.WriteLine("Press '6' to View attendance");
                Console.WriteLine("Press '7' to see top 3 students");
                Console.WriteLine(" ");
                Console.WriteLine("Your choice: ");
                choice = Console.ReadLine();
                if (choice == "1")
                {
                    obj1.writeonfile(filepath);
                }
                if (choice == "2")
                {
                    Console.WriteLine("Enter 'Name' of student to search record");
                    nameofstudent = Console.ReadLine();
                    obj1.searchname(nameofstudent);
                }
                if (choice == "3")
                {
                    Console.WriteLine("Enter 'ID' of student to search record");
                    idofstudent = Console.ReadLine();
                    obj1.searchid(idofstudent);
                }
                if (choice == "4")
                {
                    Console.WriteLine("Enter name of student to delete record");
                    nameofstudent = Console.ReadLine();
                    obj1.deletion(nameofstudent);
                }
                if (choice == "5")
                {
                    Console.WriteLine("Enter ID of student to mark attendance");
                    studentid = Console.ReadLine();
                    obj1.attendance(studentid);
                }
                if (choice == "6")
                {
                    obj1.viewattendance();
                }
                Console.ReadLine();
                Console.WriteLine("If you want to Continue Press 'y' otherwise Press any key to Exit");
                cont = Console.ReadLine();
            }while (cont == "y" || cont == "Y");
        }