? 發問時間: 社會與文化語言 · 1 0 年前

C語言程式設計題目

Write a program to read a series of names, one per line,from standard

input, and write out those names spelled in reverse order to standard

output. Use I/O redirection and pipes to do the following:

a. Input a series of names that are typed in from the keyboard, and

write them out, reversed, to a file called file1.

b.Read the names in from file1; then write them out, re-reversed, to a

file called file2.

c.Read the names in from file2 ,reverse them again, and then sort the

resulting list of reversed words using sort.

1 個解答

評分
  • 1 0 年前
    最佳解答

    Write a program to read a series of names, one per line,from standard input,

    ==> 寫一個程式(command line program)從標準輸入(standard input, stdin) 中讀取一系列名字,

    每一個名字(在 stdin 中是)一行,

    and write out those names spelled in reverse order to standard output.

    ==> 然後將那些名字反著拼再寫入 standard output (stdout) 中,

    Use I/O redirection and pipes to do the following:

    ==> 使用 I/O redirection (<, >, <<, >>) 和 pipes (|) 做下列事項:

    a. Input a series of names that are typed in from the keyboard, and write them out, reversed, to a file called file1.

    ==> 從鍵盤輸入一系列的名字,反著拼,再將他們一一寫入取名為"file1"的檔案中。

    b. Read the names in from file1; then write them out, re-reversed, to a file called file2.

    ==> 從檔案 file1中一一讀出名字,再反著拼一次(這次拼回正常的了),寫入叫"file2"檔案中。

    c. Read the names in from file2, reverse them again, and then sort the resulting list of reversed words using sort.

    ==> 從檔案 file2中一一讀出名字,再反著拼一次(這次又拼回反的了),再用排序指令 (sort) 將這些「反字結果列表」重新排序一次。

還有問題?馬上發問,尋求解答。