I wonder which fellow can get a text - format English - Chinese dictionary, this way it will be more enjoyable...
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
DigestI
View 22,521 Replies 55
@echo off
:: Function:
::
:: ① Enter English, display all contents under the English entry;
:: At the same time, display other words with the same meaning or the same header in the word bank;
:: ② Enter Chinese, display all English words whose meanings contain the Chinese vocabulary
::
:: Format requirements for the word bank file:
::
:: The first line of the file must be empty, or the text of the content to be searched must not appear
:: The first line of a paragraph block must be a pure English vocabulary
:: The Chinese translation content is immediately on the next line (no pure letter lines are allowed), and there can be multiple lines
:: Examples can be below the translation
:: Add a Chinese half-width semicolon and space after each explanation
:: The explanation content can be in the same line or in different lines
:: Try to avoid the situation where the example content below the explanation is connected with a Chinese half-width semicolon and space
:: Empty lines are allowed to separate each paragraph block
::
:: code by JM 2006-10-11~14 http://www.cn-dos.net Thanks to 3742668
:input_var
title Chinese-English Translator
cls
set line=
set postil=
set postil_content=
set similar=
set input=
set /p input=Please enter the content to be queried (press Enter directly to exit):
if "%input%"=="" exit
ren ============== Determine input type ==============
cls
echo %input%|findstr "^*$">nul && goto letters || goto not-letters
ren ============== English to Chinese ==============
:letters
title Chinese-English Translator-English to Chinese
:: First extract the line number of the first record that matches the word, then find the first occurrence of the word below this line
:: The content between the two words is the translation of English
for /f "tokens=1* delims=:" %%i in ('findstr /nirc:"^%input%" word bank.txt') do (
if /i "%%j"=="%input%" set line=%%i&goto word_finded
)
if "%line%"=="" goto no-item
:word_finded
echo _________________________________
echo The word to be found: %input%
echo.
setlocal enabledelayedexpansion
for /f "skip=%line% delims=" %%i in (word bank.txt) do (
echo %%i|findstr "^*$">nul &&(goto no-postil)||(
echo %%i&if not "%%i"=="" set postil=exist
echo %%i|findstr /c:"; ">nul &&(
set postil_content=!postil_content!%%i
)
)
)
:no-postil
if "%postil%"=="" (echo There is no content under the entry of %input% & goto end)
echo _________________________________
echo Words with similar meanings:
echo.
for /f "tokens=1* delims=:" %%i in ('findstr /nr "%postil_content%" word bank.txt') do (
if not "%%j"=="" set /a line=%%i-2&& call :check_similar
)
if "%similar%"=="" echo None for the time being.
echo _________________________________
echo Other words with the same header:
echo.
set similar=
for /f "tokens=1* delims=:" %%i in ('findstr /nirc:"^%input%" word bank.txt') do (
echo %%j|findstr "^*">nul && (
if not "%%j"=="%input%" set similar=exist&echo %%j
)
)
if "%similar%"=="" echo None for the time being.
:end
echo _________________________________
echo.
pause
goto input_var
:check_similar
:: Find all English words whose meanings contain %postil_content%
for /f "skip=%line% delims=" %%i in (word bank.txt) do (
echo %%i|findstr "^*$">nul &&(
if not "%%i"=="%input%" (
echo %%i&set similar=exist&goto :eof
) else (goto :eof)
)||(set /a line=%line%-1& goto check_similar)
)
goto :eof
ren ============== Chinese to English ==============
:not-letters
title Chinese-English Translator-Chinese to English
:: First extract the line number of the first record that contains the Chinese vocabulary, then find the pure letter line above this line
:: Then the first pure letter line found is the English word to be found
:: Repeat the above process to find all English words whose meanings contain this Chinese vocabulary
echo _________________________________
echo.
echo %input%:
echo.
for /f "tokens=1* delims=:" %%i in ('findstr /nrc:"%input%; " word bank.txt') do (
if not "%%j"=="" set /a line=%%i-2&& call :check_word
)
if "%postil%"=="" goto no-item
echo _________________________________
echo.
pause
goto input_var
:check_word
:: Find all English words whose meanings contain %input%
set postil=exist
for /f "skip=%line% delims=" %%i in (word bank.txt) do (
echo %%i|findstr "^*$">nul &&(echo %%i&&goto :eof)||(
set /a line=%line%-1&& goto check_word
)
)
goto :eof
ren ============== Error prompt ==============
:no-item
cls
echo _________________________________
echo.
echo %input%:
echo The entry is not found!
echo _________________________________
echo.
pause
goto input_var
① Enter the route name, and display all the stops of this route and the departure and arrival times;
② Enter the departure stop and the arrival stop, display the available trips, and display all the stops between these two stops in each route and the departure and arrival times;
| Rater | Score | Time |
|---|---|---|
| redtek | +1 | 2006-10-18 07:09 |
② Enter the departure and arrival stations, display the trains that can be taken, and display all stations between these two stations in each line and the departure and arrival times;
Originally posted by namejm at 2006-10-17 12:11:
Today I suddenly thought that using the idea of 33F, one can write a very practical thing like a public transportation route information query tool. It is expected to achieve the following two functions:
Those who are interested might as well try to...
Originally posted by zxcv at 2006-10-17 13:43:
This is complicated. It is estimated that it is not easy to judge the meeting points of these train numbers, and there may be more than 3 train numbers.
First one
Second one is the add and delete window
Third one is the query window
Fourth one is the required files
This is the main file and a library file.
The Tel.db file is not there at the beginning. It will only appear when the user adds a contact.
Originally posted by zouzhxi at 2006-11-14 18:43:
Just modified the BAT of moderator namejm a little, and it became a DOS version of the address book...
Now I'll show you the screenshots...
Modification function is not available for the time being, and you can only modify it manually in the database.
@echo off
echo.
set /p deletePerson= Delete person:
>TelN.db echo ::Phone book database
>>TelN.db echo --------------------------------------------------
>>TelN.db echo.
setlocal EnableDelayedExpansion
for /f "delims=" %%i in (Tel.db) do (
if "%%i" == "::" set /a Num+=1
)
set Delete=echo
for /f "skip=3 delims=" %%i in (Tel.db) do (
if "%%i" == "%deletePerson%" set Delete=rem&&set /a N-=1
!Delete! %%i>>TelN.db
if "%%i" == "::" !Delete!.>>TelN.db&&set /a N+=1&&cls&&echo.&&echo !N!/%Num%&&set Delete=echo
)
pause
exit
::Phone book database
--------------------------------------------------
Zhang San
Contact name: Zhang San
Contact phone: Zhang San
Contact address: Zhang San
Contact unit: Zhang San
::
Li Si
Contact name: Li Si
Contact phone: Li Si
Contact address: Li Si
Contact unit: Li Si
::
Wang Wu
Contact name: Wang Wu
Contact phone: Wang Wu
Contact address: Wang Wu
Contact unit: Wang Wu
::