SHARE
TWEET

Untitled

a guest Jan 27th, 2020 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. namespace ConsoleApplication23
  7. {   class Worker
  8.     {
  9.     public string surname;
  10.     public int[] zp = new int[6];
  11.     Worker[] data;
  12.     public Worker()
  13.     { data = new Worker[50]; }
  14.     public Worker this[int index]
  15.     {
  16.         get { return data[index]; }
  17.         set{ data[index]=value;}
  18.     }
  19.     }
  20.     class Program
  21.     {
  22.         static void Main(string[] args)
  23.         {
  24.             int i, n;
  25.             Console.WriteLine("\tInformation:\n\n");
  26.             Worker CJ = new Worker();
  27.             Random rnd = new Random();
  28.             CJ[0] = new Worker();
  29.             CJ[1] = new Worker();
  30.             CJ[2] = new Worker();
  31.             CJ[0].surname = "Krylov";
  32.             CJ[1].surname = "Samolyotov";
  33.             CJ[2].surname = "Letaylova";
  34.             for(i=0;i<6;i++)
  35.             {
  36.                 CJ[0].zp[i] = rnd.Next(40000,50000);
  37.                 CJ[1].zp[i] = rnd.Next(40000, 50000);
  38.                 CJ[2].zp[i] = rnd.Next(40000, 50000);
  39.             }
  40.             File.WriteAllText("C:\\Users\\kbstudentint\\Desktop\\О сотрудниках.txt", "");
  41.             for (i = 0; i < 3; i++)
  42.             {
  43.                 Console.WriteLine("{0} employee: {1}", i + 1, CJ[i].surname);
  44.  
  45.                 File.AppendAllText("C:\\Users\\kbstudentint\\Desktop\\О сотрудниках.txt", Environment.NewLine + (i + 1) + " employee: " + CJ[i].surname);
  46.                 Console.WriteLine("\nSalaries:");
  47.                 File.AppendAllText("C:\\Users\\kbstudentint\\Desktop\\О сотрудниках.txt", Environment.NewLine + "Salaries:" + Environment.NewLine);
  48.                 for (int j = 0; j < 6; j++)
  49.                 {
  50.                     Console.WriteLine("{0}", CJ[i].zp[j]);
  51.                     File.AppendAllText("C:\\Users\\kbstudentint\\Desktop\\О сотрудниках.txt", CJ[i].zp[j].ToString() + Environment.NewLine);
  52.                 }
  53.                 Console.WriteLine("\n\n");
  54.             }
  55.             Console.ReadKey();
  56.         }
  57.     }
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top