If you want to print values next to one another, you use the semicolon, which suppresses movement tote next print zone. Here is an example: PRINT I;-2;3+3 1 -26 Using the semicolon, results are printed next tone another, with the space for the sign in front and a space after. The comma and the semicolon are used as delimiters to separate values.Because of this,no commas should be placed in values over 999.To print 12,345we must type PRINT 12345。If we write PRINT12,345,BASIC will interpret it as the two numbers12 and 345。 In our initial discussions we Novell be printing to the screen.however.the same Information can be printed on the printer if our system has one.In most systems this is done with the LPRINT statement MINT uses the same syntax as PRINT.However, PRINT directs output to the printer instead of the screen.On some systems,simultaneously pressing the[Ctrl] and [Parts] keys or the [Ctrl]。and [P] keys will cause all output that is sent to the screen to be sent to the printer as well.This acts as a toggle.That is, the first [Ctrl] and [Parts] (for example) will turn on the connection between the computer and printer. The next [Citric] and putsch will turn it off. Because dialects vary so widely, we will not describe LPRINT in detail. 翻译: 怎样使用BASIC语言 BASIC语言入门 学习计算机语言的最好方法就是试着编程,且如果你敢于犯错误的一话,将学得更快。不要担心敲错了什么会弄坏计算机。计算机会照顾好自己的。如果你想知道BASIC对一条特定的指令反应如何,不妨上机操作试试看。 每条指令都有特别的格式或语法。如果语法错误,BASIC一般将显示出错信息。接着可重新键入正确的指令。 首先需要知道的是如何进入和 退出BASIC系统。一旦你学了一些BASIC语言之后,便可开始键入指令。敲完一行后,计算机将等待你键入指示程序行结束的信号。此时,敲回车[Enter]键即可。该键较大,通常位于字母键盘的右边。它与打字机上的换行回车键的功能和位置都相仿。 有一闪烁亮点提示下一个字符出现的位置。这就是光标。敲回车键后,光标移到下一行的开头。光标总是提示你当前在屏幕上所处的位置。 现在,让我们试着把BASIC当 计算器使用。这需要用到打印语句 PRINT 3 3 我们键入“PRINT”,接着是一 个空格和数字“3”,并按回车 键。BASIC的反应就是显示数字3。 PRINT 2+2 4 我们键入“PRINT”和空格及数 值表达式“2+2”。BASIC将表达式 的值计算出来并显示结果。再举一个例子: PRINT 3,2+2 34 当我们敲回车键时,即是通知BASIC解释程序检查指令有无错误,如果没有发现错误,就将指令编译成机器语言并执行。所有这些工作完成的速度极快!让我们再多看几个例子。 |