Water collected between towers: Difference between revisions
→{{header|C sharp|C#}}: added using dependencies, modified code to show towers upright instead of upside-down. Changed characters to match REXX 9.3 output when showing tower blocks.
(Added C# program, translation of vb.NET) |
(→{{header|C sharp|C#}}: added using dependencies, modified code to show towers upright instead of upside-down. Changed characters to match REXX 9.3 output when showing tower blocks.) |
||
Line 306:
=={{header|C sharp|C#}}==
Translation from [[{{FULLPAGENAME}}#Visual_Basic_.NET|Visual Basic .NET]]. See that entry for code comments and details.
<lang Csharp>using System;</lang>
<lang Csharp>static void Main(string[] args)
{
Line 315 ⟶ 316:
string blk = "", lf = "\n"; for (int i = 0; i < wta.Length; i++)
{
int
{
{
if (wta[i][j] > 0)
{
else
}
if (
} while (
while (blk.Contains("
while (blk.Contains("
if (args.Length > 0) Console.
Console.WriteLine("Block {0} retains {1,2} water units.\n", i + 1,
(blk.Replace(lf, "").Replace("B", "").Replace(" ", "")).Length);
}
|