Title 計算機プログラミング I 同演習講義ノート 2007 Author(s) 井上, 純一 Citation Issue Date 2007-08-22T04:23:05Z DOI Doc URLhttp://hdl.handle.net/2115/28047 Right Type learningobject Additional There are other files related to th Information above URL. File Information ProgI2007_2.pdf ( 第 2 回講義 演習ノート ) Instructions for use Hokkaido University Collection of Scholarly and
I #2 : ( 8-13), () URL : http://chaosweb.complex.eng.hokudai.ac.jp/ j inoue/prog2007/prog2007.html 19 4 13 6 9 6.1....................................... 9 6.2......................................... 12 6.2.1................................... 12 6.2.2............................ 13 6.3.............................. 16 6.4................................. 17 7 : 17 7.1................................ 17 6, Linux [] []., (),.,,,,., *.*,, LMS (Learninig Manegement System) ( LMS )., LMS,,.,,. 6.1,, (),. 9
, () Xemacs, Ctrl-x Ctrl-s,., Xemacs xemacs test.c & 1, Xemacs, Ctrl-x Ctrl-s, test.c test.c., &,.. 6.1 test.c Xemacs,. #include<stdio.h> main() { printf("today is 13th April 2007 and Friday! "); }. Xemacs, less,. less [] []. less q OK., less,.,,, Xemacs. less,,, (),, less,. 6.2 less test.c. 1, [Enter] 10
(). cp (copy )., test.c test2.c cp test.c test2.c OK., cp [] [].. 6.3 cp, test.c, less. mv (move )., test2.c test3.c mv test2.c test3.c OK. mv [] [].. 6.4 mv, test2.c test3.c.,. rm (remove )., test3.c rm test3.c OK.,,.,,,, backup (old) file (),, text.txt, text.txt, ( )., mv, text.txt text.txt. 11
,, text.txt 2. 6.5 rm test3.c. 6.2 (),. Linux. root root user etc sbin home... work staff ta i05 akama j-inoue... yuji... works tmp Mail test.c... 10: Linux.. Xemacs, name.txt.,.,.,, ( ) 10. 6.2.1, Linux,,.,,.,, () j-inoue /home/staff/j-inoue/ 2 Xemacs,. Xemacs Ctrl-x Ctrl-s. 12
, works /home/staff/j-inoue/works/., /., Linux / /.,., works test.c /home/staff/j-inoue/works/test.c. / ( ).,,,,., (),.,, j-inoue,, works test.c./works/test.c.,.., works/test.c OK., (j-inoue) ~/works/test.c. /.,. 6.2.2,.,,. ls,. (list ). pwd (present working directory ) 13
. pwd. 6.6 pwd,. name.txt (, test.c, tmp.dat etc.),.,,,.., tmp mkdir tmp OK. ( mkdir make directory )., ls, tmp.,,. rmdir (remove directory ). tmp rmdir tmp OK.,,,.,.,.,, mv. test.c tmp mv test.c tmp/. / tmp,.. 14
6.7 tmp, test.c, name.txt 2. cd (change dirctory ).,., 10 () j-inoue, cd /home/staff/j-inoue/, staff akama cd../akama.,../. /.,, j-inoue cd works cd../, j-inoue., j-inoue works. cd /home/staff/akama/,.. 6.8 (j-inoue) tmp check.txt. tmp, Xemacs,. 15
6.3 6.8.,,,,, Linux?.,,, ()., ls ls -l l.. -rw-r--r-- 1 j-inoue staff 17 4 13 11:13 check.txt ( d, ) 9 3 1, 3, rw,, x.,, check.txt j-inoue 1, (staff ), 3., 6.8 check.txt., check.txt,? chmod. (change mode ). chmod o-r check.txt OK. o (others),. r, 3 o r 3., 3 chmod o+r check.txt + OK. oa(all, ), u(usr, ), g(group members)., rw(), x).. 6.9 tmp test.c, chmod g+w,o-r test.c. 16
6.4 man (manual )., less man less, less.,,, man Linux., man q 3. 7 : Xemacs,,., 8. 7.1,. (*.c), (a.out). Step1 : Xemacs C,,., test.c #include<stdio.h> main() { printf("today is 13th April 2007 and Friday!"); }, C. Today is 13th April 2007 and Friday!., C 3 man man ***, ***, less., less, less q. 17
main() { 1; 2;......... }., main() main. {},,,., main., test.c, main 3 { 5 }. {}, (statement),,,,. 1, ;. test.c, #include<stdio.h>, stdio.h, (test.c)..h ( ).,, 1. test.c printf("today is 13th April 2007 and Friday!");, printf(), printf("");,...., main printf, Today is 13th April 2007 and Friday!.,, (), (executable file). 18
Step 2 : test.c gcc test.c -lm., lm.,. a.out.. 7.1 test.c., ls a.out., test.c printf (;) test2.c, test.c,. Step 3 : a.out,./a.out OK../[].,. 7.2 test.c a.out,. 7.3 test2.c, a.out. #include<stdio.h> main() { double a,b,x,y; a=5; b=3; x = a+b; y = a*b; 19
} printf("sum=%lf prod=%lf\n",x,y); LMS 1[s] [m],., 9.8[m/s 2 ]. 20