3,4 hours on Tuesday
Computer Exercise 1
Civil and Environmental Engeeering
[English Version] [Japanese Version]
1.1 Sample Program
2.2 ps Command ( Process Check )
1.2 Make Program by vi Editor ( Fortran )
(2) Input Words
1.3 Compilation Source File & Run
CONTENTS
vi command list
(1) Open File
1.3 Compilation Source Program & Run
(2) Input Words
(3) Make Program
(4) Close vi Editor
(5) Delete(1 Word, 1 Line)
(1) Fortran Compilation
(2) C Cmpilation
(3) Compilation Plural Files
(4) Change Run Name
1.1 Sample Program
(1) Fortran
$ vi test.f
program main
write(6,*) ' exercise 1'
stop
end
(2) C
main( ){
printf(" exercise 2\n");
}
(1) Open File
$vi test2.f
■ ( Clear Display )
~
~
~
~
"test2.f" [New File] ( when New file )
"test2.f" 4 Lines, 68 Characters ( when Old file )
Input [a] or [ i] Key -> Standby Input
[a] ; input words behind Cursor
[i] ; input words fore Cursor (insert)
■ (no changes in display)
~
~
~
~
"test2.f" [New File]
(3) Make Program
(4) Close vi Editor
quadvide
vi Command List
<-Spacing 6 words-> program main
write(6,*) ' exercise 1'
stop
end
Push [Esc] key( no changes in display)
Input [:] key
~
~
~
:← ( shown [:] under the display)
[wq] ; quit with overwrite
[q] ; quit
[q!] ; quit by compulsion
~
~
~
:q ( input [q] key )
$ ( quit from vi )
(5) Delete ( 1 word, 1 Line )
Move Cursor on [n] and push [x] key.
progranm main ( I want delete [n].
write(6,*) ' exercise 1'
stop
end
program main ( complete 1 word delete )
write(6,*) ' exsercise 1'
stop
end
Move Cursor on the line and push [dd] keys.
program main
write(6,*) ' exercise 1'
write(6,*) ' exercise 2' ( I want delete this 1 line.)
stop
end
program main
write(6,*) ' exercise 1' ( Complete 1 line delete )
stop
end
(1) Fortran Compilation
$ f77 test.f
** main === End of Compilation 1 ===
1501-510 Compilation successful for file test.f.
$ ( Complete Compilation )
$a.out ( Run Program )
exercise 1 ( Output Result)
$
(2) C Compilation
$ cc test.c
$ ( Complete Compilation )
$a.out ( Run Program )
exercise 2 ( Output Result )
$
(3) Compilation Plural Files
$ f77 test1.f test2.f
test1.f:
test2.f:
$
(4) Change Run Name
$ f77 test.f -o TEST ( Change run name by '-o' option )
** main === End of Compilation 1 ===
1501-510 Compilation successful for file test.f.
$ ( Complete Compilation )
$TEST ( Rum Program )
exercise 1 ( Output Result )
$
ContactNaoyuki INUKAI
inu@nagaokaut.ac.jp
Deptartment of Civil and Environmental Engineering
Nagaoka University of Technology
Nagaoka,Niigata 940-2188,Japan
Tel:+81-258-47-9624 (Office), Fax:+81-258-47-9600
GLESCO
( GLobe
,
EStuary and COast )
Copyright
Hydrauric Engineering Lab. Nagaoka University of Technology