我刚刚使用这种编程语言创建了一个文本到语音转换器。
代码是,
DO
CLS
PRINT "This is the program built by Adhikari Newtorks Team Using QBASIC..........."
PRINT "This is a text to speech converter.."
PRINT
PRINT
INPUT "Enter the word to pronounce: ", speak$
OPEN "sound.vbs" FOR OUTPUT AS #1
PRINT #1, "dim speechobject"
PRINT #1, "set speechobject=createobject ("; CHR$(34); "sapi.spvoice"; CHR$(34); ")"
PRINT #1, "speechobject.speak"; CHR$(34); speak$; CHR$(34)
CLOSE #1
SHELL "sound.vbs"
KILL "sound.vbs"
LOOP
你知道,这里我已经用这种语言编写了一个visual basic代码。我主要的困惑是,我可以说这个程序是用QBASIC编程语言构建的,还是我应该称它为Visual Basic程序?
这是一个启动VBScript的QBasic程序。
虽然我真的不明白这有什么意义。好像有人已经评论过了,为什么不直接写一个vbscript呢?代码也要短得多,像这样:
Do
str = InputBox("Enter the word to pronounce","Enter text")
Dim speechobject
Set speechobject = createobject("sapi.spvoice")
speechobject.speak str
Loop Until (str = "")
如果你想在命令提示符中运行它,你可以输入:cscript /nologo myscript.vbs