Advertisement
wingman007

Tasks4Excercises

Oct 30th, 2023 (edited)
832
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.04 KB | None | 0 0
  1. // Random generate tasks for excercises
  2. // https://introprogramming.info/wp-content/uploads/2018/07/CSharp-Principles-Book-Nakov-v2018.pdf
  3.  
  4. Random randChapters = new Random(); // Chapters
  5. Random randTask = new Random(); // Task
  6. int chapter = 1;
  7. int task = 1;
  8. int min = 0, max = 0;
  9.  
  10. Console.WriteLine("От книгата на адрес: https://introprogramming.info/wp-content/uploads/2018/07/CSharp-Principles-Book-Nakov-v2018.pdf");
  11.  
  12. for (int i = 0; i < 1000; i++)
  13. {
  14.     Console.Write("Ф номер завършващ на: {0:000} : ", i);
  15.     for (int j = 0; j < 3; j++) // 3 Tasks for each student
  16.     {
  17.         // 1. First Control chapters 1 to 6
  18.         //chapter = randChapters.Next(1, 6);
  19.         //if (chapter == 1)
  20.         //{
  21.         //    min = 10;
  22.         //    max = 10 + 1;
  23.         //}
  24.         //else if (chapter == 2)
  25.         //{
  26.         //    min = 10;
  27.         //    max = 12 + 1;
  28.         //}
  29.         //else if (chapter == 3)
  30.         //{
  31.         //    min = 1;
  32.         //    max = 16 + 1;
  33.         //}
  34.         //else if (chapter == 4)
  35.         //{
  36.         //    min = 1;
  37.         //    max = 12 + 1;
  38.         //}
  39.         //else if (chapter == 5)
  40.         //{
  41.         //    min = 1;
  42.         //    max = 11 + 1;
  43.         //}
  44.  
  45.         // 2. Second control chapters 6 to 9
  46.         chapter = randChapters.Next(6, 10);
  47.         if (chapter == 6)
  48.         {
  49.             min = 1;
  50.             max = 18 + 1;
  51.         }
  52.         else if (chapter == 7)
  53.         {
  54.             min = 1;
  55.             max = 25 + 1;
  56.         }
  57.         else if (chapter == 8)
  58.         {
  59.             min = 1;
  60.             max = 14 + 1;
  61.         }
  62.         else if (chapter == 9)
  63.         {
  64.             min = 1;
  65.             max = 13 + 1;
  66.         }
  67.         //else if (chapter == 10) // The studens consider chaper 10 too dificult
  68.         //{
  69.         //    min = 1;
  70.         //    max = 11 + 1;
  71.         //}
  72.  
  73.         task = randTask.Next(min, max);
  74.         Console.Write($"Глава {chapter} зад. {task};");
  75.     }
  76.     Console.WriteLine();
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement