The
first homework assignment given in more detail below is, "make a FORTRAN code
say hello." Also e-mail me
the code and some evidence that it works. This seemingly trivial assignment
involves finding a place to work, using an editor and/or a compiler, finding my
e-mail address and mailing the code to me. I especially want a comment or to in
the e-mail about how you did these things.
For a sample in C see ..\Progdet\FandC2.htm
Assuming that you get Watfor
from me. The Watfor routines contain watfor77.exe and
e.exe. The first is for computers without a coprocessor. I renamed the second
from its original name of watfor87.exe. These files are both and editor and an
"interpreter".
enter
the command e hello.for
e hello.for
<beginning of file>
<end of file>
hello.for - File not found
F1:Pg 2:Pg¯ 3:L 5:L¯ 6:Ldel 7:Select/deselect 8:Cut 9:Scrn/Cmd 10:Help
of
course it could not find the file you haven't created it yet. The last line
tells what the function keys do, the most important of which is F10 for help.
F9 toggles between the command line and the file. help entered on the command
line gives even more information. It is very hard to find that the search
command /string always starts from the top of the file and that +/string
is needed to continue the search. The command = repeats the last
command. enter the code by issuing the
command i to get into insert mode.
i
<beginning of file>
_
<end of file>
the
tab key will move you to col 10, enter the code
<beginning of file>
print*,’hello’
end
<end of file>
then
enter F9 to get to the command line followed by the command run
run
hello
then
enter exit to save your code
exit
hello.for - lines transferred = 2
A zip of the Watcom project in C++ is in ..\Progdet\cpp\HWORLD.ZIP.
#include <iostream.h>
int main()
{cout
<< "Hello, World!\n";} The
cout << is a C++ concept designed to free us
from formatting problems.
This code works in “Dos”, linnux
and Unix. But
when run from the Watcom Ide
produces only a flash on the screen.
This is maybe a bit harder in C.
#include <stdio.h>
void main()
{char c1;
printf( "Hello,
World!\n"); Note that I need a
\n to move down a line and that the string is in quotes.
c1=getc(stdin); } The
purpose of the c1 and getc is to cause the code to
pause while waiting for human input.