wingman007 icon

Tasks4Excercises

wingman007 | PRO | 12/04/23 06:59:52 AM UTC (Edited) | 0 ⭐ | 1398 👁️ | Never ⏰ | []
C# |

2.04 KB

|

None

|

0 👍

/

0 👎

// Random generate tasks for excercises
// https://introprogramming.info/wp-content/uploads/2018/07/CSharp-Principles-Book-Nakov-v2018.pdf
 
Random randChapters = new Random(); // Chapters
Random randTask = new Random(); // Task
int chapter = 1;
int task = 1;
int min = 0, max = 0;
 
Console.WriteLine("От книгата на адрес: https://introprogramming.info/wp-content/uploads/2018/07/CSharp-Principles-Book-Nakov-v2018.pdf");
 
for (int i = 0; i < 1000; i++)
{
    Console.Write("Ф номер завършващ на: {0:000} : ", i);
    for (int j = 0; j < 3; j++) // 3 Tasks for each student
    {
        // 1. First Control chapters 1 to 6
        //chapter = randChapters.Next(1, 6);
        //if (chapter == 1)
        //{
        //    min = 10;
        //    max = 10 + 1;
        //}
        //else if (chapter == 2)
        //{
        //    min = 10;
        //    max = 12 + 1;
        //}
        //else if (chapter == 3)
        //{
        //    min = 1;
        //    max = 16 + 1;
        //}
        //else if (chapter == 4)
        //{
        //    min = 1;
        //    max = 12 + 1;
        //}
        //else if (chapter == 5)
        //{
        //    min = 1;
        //    max = 11 + 1;
        //}
 
        // 2. Second control chapters 6 to 9
        chapter = randChapters.Next(6, 10);
        if (chapter == 6)
        {
            min = 1;
            max = 18 + 1;
        }
        else if (chapter == 7)
        {
            min = 1;
            max = 25 + 1;
        }
        else if (chapter == 8)
        {
            min = 1;
            max = 14 + 1;
        }
        else if (chapter == 9)
        {
            min = 1;
            max = 13 + 1;
        }
        //else if (chapter == 10) // The studens consider chaper 10 too dificult
        //{
        //    min = 1;
        //    max = 11 + 1;
        //}
 
        task = randTask.Next(min, max);
        Console.Write($"Глава {chapter} зад. {task};");
    }
    Console.WriteLine();
}

Comments