1. An Useless Program.?
- Posted by Alan Tu <ATU5713 at COMPUSERVE.COM>
Sep 03, 1998
-
Last edited Sep 04, 1998
This program is Euphorian, but its purpose may be off-topic.
I am in a QBasic programming class. The instructor requires us to docume=
nt
every single program with the same information in the heading. Because I=
would rather work on the program then actually documenting it 100 times,
and to brush up on some Euphoria skills, I have written a program in
Euphoria, called QPREP.EX. It preps a file specified on the command line=
by:
1. inserting a row of 40 * s
2. by prompting, using Irv's indespensible input routine, for the name o=
f
the program
3. by inserting a name saying that I'm the author of this would-be QBasi=
c
program
4. by inserting the date
Date: 9/3/98, for example
This is done in Euphoria and is seemless
5. By inserting the necessary class information
6. By prompting for and inserting the purpose of the program
Now instead of typing all that, I can launch my program, answer two
prompts, and voila, the specified file is prepped.
Below is the program.
include input.e
include get.e
clear_screen()
sequence command
command =3D command_line()
integer sum_no
sum_no =3D open(command[3], "wb")
sequence star
star =3D repeat('*',40)
star =3D '\'' & star & '\n'
sequence program
program =3D input("Enter program name: ")
puts(1,'\n')
program =3D '\'' & program & '\n'
constant name =3D "\'Written by Alan Tu\n\n"
sequence ddate
sequence day, month, year
sequence d
d =3D date()
day =3D sprintf("%d", d[3])
month =3D sprintf("%d", d[2])
year =3D sprintf("%d", d[1])
ddate =3D "\'Date: " & month & '/' & day & '/' & year & '\n'
constant class =3D "\'Mrs. Armitage, 2nd Hour\n\n"
sequence purpose
purpose =3D input("Enter purpose of program: ")
puts(1,'\n')
purpose =3D '\'' & purpose & '\n'
sequence final
final =3D star & program & name & ddate & class & purpose
puts(sum_no,final)
close(sum_no)
--Alan
=