EasyManuals Logo

Radio Shack TRS-80 Model 100 User Manual

Radio Shack TRS-80 Model 100
210 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #63 background imageLoading...
Page #63 background image
Lesson
#5
Day, Time and Date
Your Model 100 has a number
of
string functions which allow you to manipulate
string constants and string variables in various ways.
In this lesson you will learn how to use some special string functions that
"return"
the day, time and date. Also, other string functions will be used to extract information
from string constants and string variables and to output character data.
Experiment
#1
What Day is it?
DAY$ is a string function which returns the day
of
the week.
If
you type:
PRINT
DAY$
wrnID
you will see that the first three letters
of
the present day are displayed. For example,
if
today happens to be Thursday, the Computer will display
Thu
Note: You must initialize the day sometime prior to using the DAY$ function. Once
initialized, the day will be automatically updated.
If
you have not already initialized the day, this can be done by entering the following
command:
DAY$ =
"xxx"
where
"xxx"
are the first three letters
of
the current day. For example,
if
today is
Monday, enter
DAY$
=
II
M
ON"
CEBIEID
While the DAY$ function returns the first three letters
of
the day
of
the week, it is
often desirable to print the full name
of
the day (e.g. Thursday, not Thu).
The following program, which we'll call DAY, accomplishes this. Refer to Figure 5-1
for a flowchart
of
the program.
Clear working memory with the NEW command and type the following program in
from the keyboard.
10
READ
0$
20
IF
LEFT$(D$,3)-
DAY$
GO
TO
40
30
GOTO
10
40
PRINT
"TODAY
IS
";
0$
50
DATA
Sunday,
Monday,
Tuesday,
Wednesday
60
DATA
Thursday,
Friday,
Saturday
Execute this program.
The program will output the day
of
the week. Here
is
an example
of
the output:
TODAY
IS
Thursday
57

Other manuals for Radio Shack TRS-80 Model 100

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Radio Shack TRS-80 Model 100 and is the answer not in the manual?

Radio Shack TRS-80 Model 100 Specifications

General IconGeneral
BrandRadio Shack
ModelTRS-80 Model 100
CategoryDesktop
LanguageEnglish

Related product manuals