From 4a81d7cd47785c2705e59cd54315ce63fa5026e2 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Thu, 14 Mar 2024 22:09:50 +0300 Subject: [PATCH] countLettersInTextFile.d: use `argv[1]` instead of `"file.txt"` --- d-programming/countLettersInTextFile.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d-programming/countLettersInTextFile.d b/d-programming/countLettersInTextFile.d index aebb3d7..471d23e 100644 --- a/d-programming/countLettersInTextFile.d +++ b/d-programming/countLettersInTextFile.d @@ -4,9 +4,9 @@ import std.ascii : isAlpha, isWhite; import std.file : read; import std.stdio : writefln; -void main() +void main(string[] argv) { - auto fileContent = cast(string)read("file.txt"); + auto fileContent = cast(string)read(argv[1]); auto totalLetters = count(filter!(a => isAlpha(a) || isWhite(a))(fileContent)); auto percentage = (totalLetters * 100) / cast(double)fileContent.length;