From 8511afa43d7e8f1820c618fcfa08ce4152cf802d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A6=E7=BB=8D=E4=B8=A5?= <790604007@qq.com> Date: Fri, 17 Feb 2023 11:12:01 +0000 Subject: [PATCH] =?UTF-8?q?=E9=9F=A6=E7=BB=8D=E4=B8=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 韦绍严 <790604007@qq.com> --- .../p.js" | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 "\351\237\246\347\273\215\344\270\245/\346\226\207\344\273\266\347\263\273\347\273\237/p.js" diff --git "a/\351\237\246\347\273\215\344\270\245/\346\226\207\344\273\266\347\263\273\347\273\237/p.js" "b/\351\237\246\347\273\215\344\270\245/\346\226\207\344\273\266\347\263\273\347\273\237/p.js" new file mode 100644 index 0000000..6f6f845 --- /dev/null +++ "b/\351\237\246\347\273\215\344\270\245/\346\226\207\344\273\266\347\263\273\347\273\237/p.js" @@ -0,0 +1,24 @@ +let fs = require("fs"); + +var max = 0; +var min = 1000; + + +for (var i = 0; i < 100; i++) { + var num = Math.floor(Math.random() * 1001); + fs.writeFileSync("./" + i + ".txt", "" + num + ""); + + var Max_fileName; + var Min_fileName; + + if (num > max) { + max = num; + Max_fileName = i + ".txt"; + } + if (num < min) { + min = num; + Min_fileName = i + ".txt"; + } +} + +console.log("最大的文件"+Max_fileName,"最大值"+max,"最小的文件"+Min_fileName,"最小值"+min); -- Gitee