added box class
This commit is contained in:
parent
1ebc6c67b6
commit
63a0218e9d
fordulo_3/Program
.vs/Program
FileContentIndex
6bc59fa7-74d6-421a-ae29-d9171104353f.vsidx84b83a8a-186d-44f9-bc2c-79f3eb943fc5.vsidx9e11f8a1-a5a9-47df-be9a-ce8aca28cc71.vsidxb1c87362-3c3a-4373-98a0-5e724e457f47.vsidx
v17
bin/Debug
obj/Debug
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -7,7 +7,7 @@
|
||||||
"RelativeMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
"RelativeMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"AbsoluteMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|c:\\users\\szabomarton\\desktop\\verseny\\fordulo_3\\program\\doboz.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
"AbsoluteMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|C:\\Users\\szabomarton\\Desktop\\Verseny\\fordulo_3\\Program\\doboz.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||||
"RelativeMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|solutionrelative:doboz.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
"RelativeMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|solutionrelative:doboz.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
"RelativeDocumentMoniker": "Doboz.cs",
|
"RelativeDocumentMoniker": "Doboz.cs",
|
||||||
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\Verseny\\fordulo_3\\Program\\Doboz.cs",
|
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\Verseny\\fordulo_3\\Program\\Doboz.cs",
|
||||||
"RelativeToolTip": "Doboz.cs",
|
"RelativeToolTip": "Doboz.cs",
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAABgAAAAJAAAAAAAAAA==",
|
"ViewState": "AgIAABMAAAAAAAAAAAAUwCIAAAA5AAAAAAAAAA==",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
"WhenOpened": "2025-03-14T09:40:24.572Z",
|
"WhenOpened": "2025-03-14T09:40:24.572Z",
|
||||||
"EditorCaption": ""
|
"EditorCaption": ""
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
"RelativeDocumentMoniker": "Program.cs",
|
"RelativeDocumentMoniker": "Program.cs",
|
||||||
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\Verseny\\fordulo_3\\Program\\Program.cs",
|
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\Verseny\\fordulo_3\\Program\\Program.cs",
|
||||||
"RelativeToolTip": "Program.cs",
|
"RelativeToolTip": "Program.cs",
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAiwBIAAAANAAAAAAAAAA==",
|
"ViewState": "AgIAAA8AAAAAAAAAAAAqwCQAAAAhAAAAAAAAAA==",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
"WhenOpened": "2025-03-12T12:54:16.847Z",
|
"WhenOpened": "2025-03-12T12:54:16.847Z",
|
||||||
"EditorCaption": ""
|
"EditorCaption": ""
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"RelativeMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
"RelativeMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"AbsoluteMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|c:\\users\\szabomarton\\desktop\\verseny\\fordulo_3\\program\\doboz.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
"AbsoluteMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|C:\\Users\\szabomarton\\Desktop\\Verseny\\fordulo_3\\Program\\doboz.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||||
"RelativeMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|solutionrelative:doboz.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
"RelativeMoniker": "D:0:0:{6A74A9DE-500D-46FF-859A-18F4A752D2A5}|Program.csproj|solutionrelative:doboz.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
"RelativeDocumentMoniker": "Doboz.cs",
|
"RelativeDocumentMoniker": "Doboz.cs",
|
||||||
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\Verseny\\fordulo_3\\Program\\Doboz.cs",
|
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\Verseny\\fordulo_3\\Program\\Doboz.cs",
|
||||||
"RelativeToolTip": "Doboz.cs",
|
"RelativeToolTip": "Doboz.cs",
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAABgAAAAJAAAAAAAAAA==",
|
"ViewState": "AgIAABMAAAAAAAAAAAAUwCIAAAA5AAAAAAAAAA==",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
"WhenOpened": "2025-03-14T09:40:24.572Z",
|
"WhenOpened": "2025-03-14T09:40:24.572Z",
|
||||||
"EditorCaption": ""
|
"EditorCaption": ""
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
"RelativeDocumentMoniker": "Program.cs",
|
"RelativeDocumentMoniker": "Program.cs",
|
||||||
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\Verseny\\fordulo_3\\Program\\Program.cs",
|
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\Verseny\\fordulo_3\\Program\\Program.cs",
|
||||||
"RelativeToolTip": "Program.cs",
|
"RelativeToolTip": "Program.cs",
|
||||||
"ViewState": "AgIAAAMAAAAAAAAAAAAiwBUAAAAJAAAAAAAAAA==",
|
"ViewState": "AgIAAA8AAAAAAAAAAAAqwBgAAAAeAAAAAAAAAA==",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
"WhenOpened": "2025-03-12T12:54:16.847Z",
|
"WhenOpened": "2025-03-12T12:54:16.847Z",
|
||||||
"EditorCaption": ""
|
"EditorCaption": ""
|
||||||
|
|
|
@ -8,13 +8,13 @@ namespace Program
|
||||||
{
|
{
|
||||||
internal class Doboz
|
internal class Doboz
|
||||||
{
|
{
|
||||||
public string Type { get; set; }
|
public char Type { get; set; }
|
||||||
|
|
||||||
public Doboz Children = null;
|
public Doboz Children = null;
|
||||||
|
|
||||||
public Doboz Parent = null;
|
public Doboz Parent = null;
|
||||||
|
|
||||||
public Doboz(string Type) {
|
public Doboz(char Type) {
|
||||||
this.Type = Type;
|
this.Type = Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,5 +23,20 @@ namespace Program
|
||||||
doboz.Parent = this;
|
doboz.Parent = this;
|
||||||
this.Children = doboz;
|
this.Children = doboz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PrintBoxContent(int indent = 0)
|
||||||
|
{
|
||||||
|
string indentStr = "";
|
||||||
|
for (int i = 0; i < indent; i++)
|
||||||
|
{
|
||||||
|
indentStr += "->";
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine($"{indentStr}{this.Type}");
|
||||||
|
if (this.Children != null)
|
||||||
|
{
|
||||||
|
this.Children.PrintBoxContent(indent + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,38 @@ namespace Program
|
||||||
|
|
||||||
foreach (var item in AllBoxes)
|
foreach (var item in AllBoxes)
|
||||||
{
|
{
|
||||||
Console.WriteLine(item);
|
Doboz doboz = new Doboz(item);
|
||||||
|
foreach (var box in Boxes)
|
||||||
|
{
|
||||||
|
if (doboz.Type == 'A')
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (box.Type == 'A' && box.Children == null)
|
||||||
|
{
|
||||||
|
if (doboz.Type == 'B' || doboz.Type == 'C')
|
||||||
|
{
|
||||||
|
box.AddChildren(doboz);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (box.Type == 'B' && box.Children == null)
|
||||||
|
{
|
||||||
|
if (doboz.Type == 'C')
|
||||||
|
{
|
||||||
|
box.AddChildren(doboz);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Boxes.Add(doboz);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in Boxes)
|
||||||
|
{
|
||||||
|
item.PrintBoxContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user