[問題] C語言中字串判斷與轉換字元大小寫問題
程式碼網址:http://nopaste.info/05a385361c.html
平台: Unix Vim
程式目的:
輸入預先儲存在檔案當中的測資, 將字串當中
每個單字的第一個字母轉換為大寫,其餘轉成小寫.
若該單字全為大寫則不動.
Ex: cAUSed -> Caused, nccu->Nccu, NCcU->NccU, NCCU->NCCU
所遇到問題如下:
下列測資1與2當中最後一行的第一個單字NCCU,會得到兩種不同的結果.
測資1:
Arson cAUSed California blaze, officials say
michael Jackson's ReSTing PlacE AmOng Greats: FoREst Lawn Glendale
NCCU HSNU rocks!
^^^^
結果1:
Arson Caused California Blaze, Officials Say
Michael Jackson's Resting Place Among Greats: Forest Lawn Glendale
NCCU HSNU Rocks!
^^^^
測資2:
Michael Jackson's Resting Place Among Greats: Forest Lawn Glendale
NCCU HSNU rocks!
^^^^
結果2:
Michael Jackson's Resting Place Among Greats: Forest Lawn Glendale
Nccu HSNU Rocks!
^^^^
---------------------------------------------------
小弟我不知道哪裡出錯了,debug搞很久. 有請板上的高手給予提示
謝謝!
--
這流浪的人,努力讓夢成真。
That's the way I live, that's the way I did.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.194.100.216
推
09/07 17:52, , 1F
09/07 17:52, 1F
推
09/07 18:13, , 2F
09/07 18:13, 2F
→
09/07 18:14, , 3F
09/07 18:14, 3F
→
09/07 18:15, , 4F
09/07 18:15, 4F
推
09/07 19:03, , 5F
09/07 19:03, 5F
→
09/07 20:12, , 6F
09/07 20:12, 6F