[C++ ] 考古題第四題
這個大家就先看看吧
因為老師上課好像沒交過
(應該不會考吧)
需要的標頭檔 #include <cstring>
1. strcpy(目標,來源) 從來源複製到目標,包括'\0'
ex: strcpy(string1,"hello world")
2. strcat(字串,stringExp) 字串後接stringExp
ex: strcat("hello world","there") 輸出為 hello worldthere
3. strlen(字串) 算字元數
ex: strlen("hello world") 的值是11
4. strcmp(字串1,字串2) 兩個字串比大小
(1)當1<2回傳負整數 , 1=2回傳0 , 1>2回傳正整數
(2)從第一個字元比較
ex:"hello" is greater than "good bye"(因為"h">"g")
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.169.176.206
推
01/14 00:12, , 1F
01/14 00:12, 1F
推
01/14 00:13, , 2F
01/14 00:13, 2F
→
01/14 00:14, , 3F
01/14 00:14, 3F
推
01/14 00:16, , 4F
01/14 00:16, 4F
推
01/14 00:27, , 5F
01/14 00:27, 5F
→
01/14 00:35, , 6F
01/14 00:35, 6F
推
01/14 00:37, , 7F
01/14 00:37, 7F
推
01/14 02:01, , 8F
01/14 02:01, 8F
推
01/14 02:03, , 9F
01/14 02:03, 9F
推
01/14 02:03, , 10F
01/14 02:03, 10F
推
01/14 02:04, , 11F
01/14 02:04, 11F