using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp7
{
struct Worker
{
public string Name { get; set; }
public int Age { get; set; }
public string Incident { get; set; }
public int Priority { get; set; }
public Worker(string N, int A, string E, int P) { Name = N; Age = A;
Incident = E; Priority = P; }
public string ToString() { return $"{Name,10} {Age,10} {Incident,10} {Priority,10}"; }
}
struct Rep
{
Worker[] db;
int index;
public Rep(int count) { db = new Worker[count]; index = 0; }
public void Add(Worker worker) { db[index++] = worker; }
public void Print() { for (int i = 0; i < index; i++) { Console.WriteLine(db[i].ToString()); } }
}
class Program
{
static Worker GetWorker()
{
Console.WriteLine("Введите Name: ");
var name = Console.ReadLine();
Console.WriteLine("Введите Age: ");
var age = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Введите Event: ");
var incident = Console.ReadLine();
Console.WriteLine("Введите Priority : ");
var priority = Convert.ToInt32(Console.ReadLine());
return new Worker(name, age, incident, priority);
}
static void Main(string[] args)
{
var rep = new Rep(10);
var w = GetWorker(); rep.Add(w);
//w = GetWorker(); rep.Add(w);
//w = GetWorker(); rep.Add(w);
rep.Print();
Console.ReadKey();
}
}
}
Это ежедневник ,смог сделать только чтобы пользователь мог добавлять записи, как сделать так ,чтобы пользователь мог удалять и редактировать записи