解释执行的语言计算机英语,计算机英语:BASIC语言入门

cb10c5c07ae058fec2d7d8bdef4c0da7.png

How to Use BASIC

Getting Started in BASIC

The best way to learn the computer language into do, and you will learn much quicker if you dare to make mistakes.Don't worry about breaking the computer by mistyping something. The computer can take care of itself If you have questions about how BASIC will respond to a particular instruction, try it and sec.

Each instruction has a particular format, or syntax. If you do not follow the correct syntax, BASIC will usually display an error message. You can then reenter the instruction correctly。

At first, you need to know both to get into BASIC and ho-, N, to get out. Once you have learned some BASIC, you may begin to type. After you type alien the computer will wait for you to type a signal that you arc finished with the line. You give this signal by tapping the [Enter] key.This key is usually a large one located to the right of the alphabetic keyboard. It is similar in purpose and in placement to the carriage [Enter] key on a typewriter.

As You type, You'll notice a blinking light on the screen that indicates where the next character will appear. This is the cursor. When you press [Enter],the cursor moves to the beginning of the next line.The cursor always lets you know where you are on the screen.

Let's try using BASIC as a calculator. We do this by using the PRINT statement,

PRINT 3

3

We typed PRINT followed by a space, the digit3,and pressed [Enter].BASIC responded by display-in the digit 3.

PRINT 2+2

4

We typed PRINT followed by a space and the numeric expression 2+2.BASIC evaluated the expressions and displayed the result. Here is another example:

PRINT 3,2+2

34

When we tap [Enter],we tell the BASIC Interpreter to check our command for errors and, if none are found, translate the command into machine language and execute. All that happens at great speed! Let’s try a few more examples.

We can make BASIC type two values on online by placing a comma between calculations.

PRINT 1,2,3,4,5

12345

PRINT I,2,3,4,5

12345

Notice what happened:BASIC divided the display line into print zones.These print zones are commonly spaced columns apart, creating five print zone son an 80-column screen.(The exact number will depend on the dialect.)The comma between the values causes BASIC to skip to the next print zone for each value. By using commas,we can print output in neat columns. The extra spaces between values on the PRINT line, as in the second example, do not affect the spacing of the output。

Numeric values are displayed with a minus signing front if the value is negative and a space in front if the value is positive.In most dialects they are also followed by a space.

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解释程序检查指令有无错误,如果没有发现错误,就将指令编译成机器语言并执行。所有这些工作完成的速度极快!让我们再多看几个例子。

通过在计算式中加逗号的方式,我们可以使BASIC在同一行里显示两个数值。

PRINT 1,2,3,4,5

12345

PRINT I,2,3,4,5

12345

注意看发生了什么变化: BASIC将显示行划分成了打印区。 这些打印区各自空出的列数相同,即将80列的屏幕划分成了5个打印区(具体数字取决于BASIC文本) 数值间的逗号使得BASIC在显示每个数值时都要跳过一个打印区。通过使用逗号,我们可打印出整齐的各列来。在第二个例子中打印行各数值间的多余空格不会影响到最终结果之间的间隔。

如果数字的值为负,则显示时其前面有一负号:若数字的值为正,显示时其前会有一空格。在大多数BASIC语句中,数值显示时其后亦有一空格。

如果你想使打印出的数值一个接一个地排列,可使用分号“;” ,它将抑制数值向下一个打印区的移动。现举一例如下:

PRINT I;-2,3+3

1-26

使用分号后,打印出的结果除了其前面的符号和后而的空格外, 将一个紧接着一个显示。

逗号和分号可用作分隔数值的工具。因此,数值999中间就不应该 有逗号I要打印12,345我们必须键入“PRITN12345”。如果编写成“PRfNT12,345”BASIC将把它编译 成两个数值“12”和“345”。

前述的讨论主要是针对屏幕打印的;实际上,如果你的系统配置有一台打印机的话,同样的信息也 可以通过打印机打印出来〕在大多 数系统中,这可通过“LPRINT “语 句来完成。LPRINT与PRINT的语法 格式是一样的。只不过,LPRINT指 示输出到打印机上而不是屏幕上。 在有些系统中,同时按住!Ctrl]键私 [PrtSc]或[Ctrll键和IN键可使所有输出既显示在屏幕上,又被送往打c-. 机。这就象一个肘节开关,(例丈 第一次按)Ctrl]键「」!Prtsc]键)将步I开计算机和打印机间的联系;第二次 按I Ctril键和[PrtScj键将切断联系 由于各BASIC文本的差别很大,在这 里我们不打算详细讲述LPRINT.

2829f2ca24f0d0090cbba57f30759f23.png

计算机英语:BASIC语言入门.doc

下载Word文档到电脑,方便收藏和打印[全文共3637字]

编辑推荐:

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

下载Word文档

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值