17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

GW-BASIC <strong>User's</strong> Guide<br />

INPUT and LINE INPUT statements have built-in PRINT statements. When an INPUT statement<br />

with a quoted string is encountered during program execution, the quoted string is printed<br />

automatically (see the PRINT statement).<br />

The principal difference between the INPUT and LINE INPUT statements is that LINE INPUT<br />

accepts special characters (such as commas) within a string, without requiring double quotation<br />

marks, while the INPUT statement requires double quotation marks.<br />

Example 1:<br />

To find the square of a number:<br />

10 INPUT X<br />

20 PRINT X "SQUARED IS" X^2<br />

30 END<br />

RUN<br />

?<br />

The operator types a number (5) in response to the question mark.<br />

5 SQUARED IS 25<br />

Example 2:<br />

To find the area of a circle when the radius is known:<br />

10 PI=3.14<br />

20 INPUT "WHAT IS THE RADIUS"; R<br />

30 A=PI*R^2<br />

40 PRINT "THE AREA OF THE CIRCLE IS"; A<br />

50 PRINT<br />

60 GOTO 20<br />

RUN<br />

WHAT IS THE RADIUS? 7.4<br />

THE AREA OF THE CIRCLE IS 171.9464<br />

Note that line 20 in the above example makes use of the built-in PRINT statement contained<br />

within INPUT.<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/INPUT.html (2 of 2)28/03/2004 21.29.30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!