diff --git "a/\344\274\215\346\231\272\350\276\211/Demo.js" "b/\344\274\215\346\231\272\350\276\211/Demo.js" new file mode 100644 index 0000000000000000000000000000000000000000..7da689cf76857722c17666e8db414f29dd03c882 --- /dev/null +++ "b/\344\274\215\346\231\272\350\276\211/Demo.js" @@ -0,0 +1,41 @@ +let fs = require('fs') + +function readfire(){ + let num,set=hok=5; + for(let i=1; i<=100; i++) + { + let fd = fs.openSync(`./login${i}.txt`,'w') + let cc = Math.round(Math.random()*100); + + fs.writeSync(fd,`${cc}`) + + let buffer=fs.readFileSync(`./login${i}.txt`,{flag:'r',encoding:'utf8'}); + num = buffer.toString() + console.log(i+"个文件:"+num); + + fs.closeSync(fd) + + /** + Number(num)==Math.max(Number(num)) + if(Math.max(Number(num)) < Number(num)+1) { + console.log(Math.max(Number(num))); + set = Number(num) + console.log("最大值"+set); + } + */ + + if(set < Math.max(Number(num))) { + set = Math.max(Number(num)) + } + + if(hok > Math.min(Number(num))) { + hok = Math.min(Number(num)) + } + + + } + console.log("最大值"+set); + // console.log("最小值"+Math.min.apply(null,hok)); + console.log("最小值"+hok); +} +readfire() \ No newline at end of file