2010-09-21 52 views

回答

4

僞代碼:

while (not end of inputFile) { 
    line = inputFile.readline() 
    line = line.replace("iPad", "iPhone") 
    tempFile.writeline(line) 
} 
inputFile.close() 
tempFile.close() 
delete inputFile 
rename tempFile to inputFile 
4

只需使用fscanf和字符串函數,您需要的所有內容都位於標準C庫的stdio.h和string.h中。我很抱歉,我不打算給你一個代碼示例,但請查看cplusplus.com以獲取有關諸如strcmp,fscanf和toupper等信息(或tolower,具體取決於您可以使用這些來區分大小寫)