Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.09 KB | None | 0 0
  1. string[,] mas0 = new string[100, 4];
  2.         string[] mas1 = new string[100];
  3.         int[] mas2 = new int[100];
  4. private void FindBiggestSumm()
  5.         {
  6.             int maxCredit = mas2[0];
  7.             int indexOfMC = 0;
  8.  
  9.             for (int i = 0; i < personList.Count; i++)
  10.             {
  11.                 mas2[i] = int.Parse(mas1[i]);
  12.             }
  13.  
  14.             if (personList.Count > 1)
  15.             {
  16.                 for (int i = 0; i < personList.Count; i++)
  17.                 {
  18.                     for (int j = personList.Count; j > i + 1; j--)
  19.                     {
  20.                         if (String.Compare(mas[i, 0], mas[j - 1, 0]) == 0)
  21.                         {
  22.                             int here = j - 1;
  23.                             mas2[i] += mas2[j-1];
  24.  
  25.                             DeleteStringMas(ref here);
  26.                         }
  27.                     }
  28.                 }
  29.  
  30.                 for (int i = 0; i < personList.Count; i++)
  31.                 {
  32.                     if (mas2[i] > maxCredit)
  33.                     {
  34.                         maxCredit = mas2[i];
  35.                         indexOfMC = i;
  36.                     }
  37.                 }
  38.             }
  39.  
  40.             MessageBox.Show("Максимальный кредит взят клиентом " + mas0[indexOfMC, 0] + " и составляет " + maxCredit + " рублей.");
  41.             maxCredit = 0;
  42.             indexOfMC = 0;
  43.         }
  44.  
  45.         private void DeleteStringMas(ref int here)
  46.         {
  47.             int t;
  48.             string[,] vs1 = new string[personList.Count, 4];
  49.  
  50.             for (int m = 0; m < personList.Count; m++)
  51.             {
  52.                 for (int j = t = 0; j < 4; j++, t++)
  53.                 {
  54.                     if (m != here)
  55.                     {
  56.                         vs1[m, t] = mas0[m, j];
  57.                     }
  58.                     else
  59.                     {
  60.                         j++;
  61.                     }
  62.                     vs1[m, t] = mas0[m, j];
  63.                 }
  64.             }
  65.             mas0 = new string[100, 4];
  66.             mas0 = vs1;
  67.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement