Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string[,] mas0 = new string[100, 4];
- string[] mas1 = new string[100];
- int[] mas2 = new int[100];
- private void FindBiggestSumm()
- {
- int maxCredit = mas2[0];
- int indexOfMC = 0;
- for (int i = 0; i < personList.Count; i++)
- {
- mas2[i] = int.Parse(mas1[i]);
- }
- if (personList.Count > 1)
- {
- for (int i = 0; i < personList.Count; i++)
- {
- for (int j = personList.Count; j > i + 1; j--)
- {
- if (String.Compare(mas[i, 0], mas[j - 1, 0]) == 0)
- {
- int here = j - 1;
- mas2[i] += mas2[j-1];
- DeleteStringMas(ref here);
- }
- }
- }
- for (int i = 0; i < personList.Count; i++)
- {
- if (mas2[i] > maxCredit)
- {
- maxCredit = mas2[i];
- indexOfMC = i;
- }
- }
- }
- MessageBox.Show("Максимальный кредит взят клиентом " + mas0[indexOfMC, 0] + " и составляет " + maxCredit + " рублей.");
- maxCredit = 0;
- indexOfMC = 0;
- }
- private void DeleteStringMas(ref int here)
- {
- int t;
- string[,] vs1 = new string[personList.Count, 4];
- for (int m = 0; m < personList.Count; m++)
- {
- for (int j = t = 0; j < 4; j++, t++)
- {
- if (m != here)
- {
- vs1[m, t] = mas0[m, j];
- }
- else
- {
- j++;
- }
- vs1[m, t] = mas0[m, j];
- }
- }
- mas0 = new string[100, 4];
- mas0 = vs1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement