|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 31 楼』:
使用 LLM 解释/回答一下
youxi01兄能否讲讲简单的实现原理和想法?
这样既方便学习又可以更好的理解与阅读代码~:)
Can Brother youxi01 talk about the simple implementation principles and ideas? This is convenient for learning and can better understand and read the code~:)
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-11-30 06:14 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 32 楼』:
使用 LLM 解释/回答一下
redtek兄,我运行你15楼的代码,总是一闪而过,不知为何。郁闷……
Brother redtek, when I run the code on the 15th floor you posted, it always flashes by in an instant. I don't know why. So depressed...
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-11-30 07:03 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 33 楼』:
使用 LLM 解释/回答一下
没加Pause,哈哈……
我命令行上操作的:)
Didn't add Pause, haha...
I operated on the command line :)
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-11-30 07:32 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 34 楼』:
使用 LLM 解释/回答一下
什么命令行那么牛?
What command line is so powerful?
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-11-30 07:38 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 35 楼』:
使用 LLM 解释/回答一下
哈哈……
总是一闪而过是你用记事本存到(可能存到桌面了),
那个批处理代码中没有运行完后 pause 等待按任意键再退出,
结果直接鼠标双击那个批处理文件就一闪运行完了就自动退出并关上了CMD Shell窗口了:)
先进入 CMD Shell 命令窗口,在那里面键入 ...BAt再运行:)
Hehe……
It always flashes by because you saved it with Notepad (probably to the desktop).
There is no "pause" in the batch code to wait for you to press any key before exiting, so when you double-click the batch file with the mouse, it runs and exits automatically, closing the CMD Shell window: )
First enter the CMD Shell command window, then type...BAt in it and run: )
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-11-30 07:48 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 36 楼』:
使用 LLM 解释/回答一下
Re lxmxn 『第 23 楼』:
无奈何兄7F的代码也存在类似问题,原因出在if %%j GTR !l! set l=%%j & set m=%%i 和 if !.%1! GTR !maxN! set maxN=!.%1! && set max=.%1 这两句上,都是同样的问题:&和&&前都多了一个空格。把这个空格去掉就可以了。
Re lxmxn 『Post 23』:
Brother NaiWaiHe's code in 7F also has similar issues. The problem lies in the two lines "if %%j GTR !l! set l=%%j & set m=%%i" and "if !.%1! GTR !maxN! set maxN=!.%1! && set max=.%1". The same problem occurs: there is an extra space before & and &&. Removing this space will fix it.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-11-30 08:18 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 37 楼』:
使用 LLM 解释/回答一下
15楼的在“set . & goto :eof”改为“set . &pause& goto :eof”即可
最简单的^_^
@echo off
setlocal EnableDelayedExpansion
set str=adadfdfseffserfefsefseetsdgadadfdfseffserfefsefseetsdga
:loop
set str$=%str$% %str:~0,1%&set str=%str:~1%
if not "%str%" == "" goto loop
for %%n in (%str$%) do (
set /a .%%n+=1
if !.%%n! GTR !maxN! set maxN=!.%%n!&&set max=%%n)
set .
echo 出现次数最多的:%max%=%maxN%
pause
exit
Changing the line "set . & goto :eof" on floor 15 to "set . &pause& goto :eof" will do it.
The simplest one ^_^
@echo off
setlocal EnableDelayedExpansion
set str=adadfdfseffserfefsefseetsdgadadfdfseffserfefsefseetsdga
:loop
set str$=%str$% %str:~0,1%&set str=%str:~1%
if not "%str%" == "" goto loop
for %%n in (%str$%) do (
set /a .%%n+=1
if !.%%n! GTR !maxN! set maxN=!.%%n!&&set max=%%n)
set .
echo The most frequent occurrence: %max%=%maxN%
pause
exit
|
|
2006-11-30 08:23 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 38 楼』:
使用 LLM 解释/回答一下
Originally posted by namejm at 2006-11-29 20:18:
Re lxmxn 『第 23 楼』:
无奈何兄7F的代码也存在类似问题,原因出在if %%j GTR !l! set l=%%j & set m=%%i 和 if !.%1! GTR !maxN! set maxN=!.%1! && set max=. ...
确实如此,我在 18 楼改的也是,一般建议用&、&&连接的最好不要有空格
Originally posted by namejm at 2006-11-29 20:18:
Re lxmxn 『第 23 楼』:
Naihe brother's code in 7F also has similar problems. The cause is in if %%j GTR !l! set l=%%j & set m=%%i and if !.%1! GTR !maxN! set maxN=!.%1! && set max=...
It's indeed the case. What I modified in 18th floor is also like this. Generally, it is suggested that there should be no spaces in the best way of connecting with &, &&
|
|
2006-11-30 08:26 |
|
|
tao0610
高级用户
    朦胧的世界
积分 579
发帖 218
注册 2006-10-24
状态 离线
|
『第 39 楼』:
使用 LLM 解释/回答一下
看来格式规范很重要.
It seems that format specification is very important.
|

认识自己,降伏自己,改变自己,才能改变别人! |
|
2006-11-30 08:27 |
|
|
kennylam
新手上路

积分 5
发帖 3
注册 2006-11-21
状态 离线
|
『第 40 楼』:
使用 LLM 解释/回答一下
Originally posted by tao0610 at 2006-11-29 04:29 PM:
用for /l 的我也贴一个!
@echo off&setlocal enabledelayedexpansion
set str=adadfdfseffserfefsefseetsdgdsfjkljdsklfjdsfdsgdsafdsaf
for /l %%i in (0,1,100) do (
if "!str:~% ...
看了这么久...还是这位朋友写得比较好!
Originally posted by tao0610 at 2006-11-29 04:29 PM:
I'll also post one using for /l!
@echo off&setlocal enabledelayedexpansion
set str=adadfdfseffserfefsefseetsdgdsfjkljdsklfjdsfdsgdsafdsaf
for /l %%i in (0,1,100) do (
if "!str:~% ...
After reading for so long... This friend's writing is still relatively good!
|
|
2007-1-8 22:11 |
|
|
tyh
初级用户
 
积分 80
发帖 43
注册 2007-4-21
状态 离线
|
『第 41 楼』:
使用 LLM 解释/回答一下
if !%1! GTR !maxN! set maxN=!%1! & set max=%1
什么意思啊~~~
If the value of %1 is greater than the value of maxN, then set maxN to the value of %1 and set max to %1.
|
|
2007-4-22 05:04 |
|
|
yaohaixu
初级用户
 
积分 30
发帖 10
注册 2007-11-19
状态 离线
|
『第 42 楼』:
谢谢大家了哈
使用 LLM 解释/回答一下
谢谢大家了哈,
作为新人我很想看到这么的好代码, 够好好学习的了。
很是受用````
就是想问问斑竹以后能不能多一些这样的活动,好给我们新人一个好的学习的机会???/
代表新人向大家说声谢谢
Thank you everyone,
As a new user, I really want to see such good code. It's enough for me to study.
It's really helpful...
I just want to ask the moderator if there can be more such activities in the future, so as to give us new users a good opportunity to study?
On behalf of new users, I say thank you to everyone
|
|
2008-1-8 02:02 |
|