?? l18.1a
字號:
#printThere is nothing to force you to write a main programon each file; just as I supplied "getnum" on a separate file,you can put different routines on different files. Writea function "length(s)" which if given a character array argument"s" returns the length of that string.Put this on a file named "length.c", and leavethe object file in "length.o".Write the main program fortesting this somewhere else. Type "ready" when you have compiledand tested your program and are happy with it.#once #create RefThis file contains several lines of quite different lengths.You should getall of them exactlyrright.#once #create answer600141916#once #create tzaqc.cmain() { char s[200]; while (gets(s)) printf("%d\n", length(s));}#usercc tzaqc.c length.c a.out <Ref >value#cmp value answer#succeed/* one way */length(s)char *s;{ int k; for (k=0; s[k]; k++) ; return(k);}#log#next19.1a 10
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -