Board logo

標題: 402 字串與檔案處理 (字串比較) [打印本頁]

作者: 陳楷翔    時間: 2023-8-26 10:57     標題: 402 字串與檔案處理 (字串比較)

1. 題目說明:
請依下列題意進行作答,使輸出值符合題意要求。

2. 設計說明:
請撰寫一程式,讓使用者輸入兩個相同長度的字串與一個正整數n,字串長度皆不超過128個字元,依ASCII碼表上的順序比對兩字串前n個字元,最後輸出兩字串前n個字元的比較結果。若使用者輸入正整數n超過字串長度,則輸出「error」。

提示:若使用 Java 語言答題,請以「JP」開頭命名包含 main 靜態方法的 class,評測系統才能正確評分。

3. 輸入輸出:
輸入說明
兩個相同長度的字串及一個正整數

輸出說明
兩字串前n個字元的比較結果(大於、等於、小於)

範例輸入1
Apple ipad
Apple ipod
5

範例輸出1
Apple ipad = Apple ipod

範例輸入2
Apple ipad
Apple ipod
9

範例輸出2
Apple ipad < Apple ipod

範例輸入3
Apple ipad
Apple ipod
15

範例輸出3
error
作者: 陳楷翔    時間: 2023-8-26 10:58

此帖僅作者可見
作者: 宥竣    時間: 2023-8-26 16:43

此帖僅作者可見
作者: 吳柏融    時間: 2023-9-9 20:45

此帖僅作者可見
作者: 張晏齊    時間: 2023-9-9 20:52

此帖僅作者可見
作者: 楊惇翔    時間: 2023-9-9 20:54

此帖僅作者可見
作者: 盧禹丞    時間: 2023-9-9 20:57

此帖僅作者可見
作者: 王述勳    時間: 2023-9-9 20:57

此帖僅作者可見
作者: 黃兆駿    時間: 2023-9-9 20:58

此帖僅作者可見
作者: 博勛    時間: 2023-9-9 21:02

此帖僅作者可見
作者: 林哲弘    時間: 2023-9-9 21:03

此帖僅作者可見
作者: 吳宥萱    時間: 2024-3-16 20:42

此帖僅作者可見




歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/) Powered by Discuz! 7.2