Starting from:

$34.99

CSE131 Homework #11 Solution

Objective :
Learn to how use File I/O, then combine with string and loops to perform some operations.
11.1
Write a program that the user read each line of letters from the 'input.txt', sorts the letters in each line and swap the case of each character , and then output the result to '11_1_result.txt'.

Hint:
Max line length: 256 Max lines: 1000 input:


Output:


11.2
There is a robot located at the position (0,0), and a string "UDLR" is given to represent a series of actions of the robot. "U" means UP, which means the robot goes up, and "D" means DOWN, which means the robot goes down. "L" means LEFT, which means the robot goes left, and "R" means RIGHT, which means the robot goes right. The above string means that the robot goes up, then down, and then left, back, and right, so the robot returned to the starting point. The attached file Test.txt has 20 strings.
Write a program to determine whether the robot can reach the origin after passing the action of each string. If it can, it will return True, if not, it will return False, and the result must be printed out.

Inpit:

Output :

繳交格式及規定 : 程式重點地方請加註解,給分也會酌量參考註解。
請繳交 .c 檔即可。
c 檔的檔名一律統一,以學號為檔名壓縮成一個以學號為名的壓縮檔
上傳,
上傳請一律繳交壓縮檔。

Example: 若學號為 B123456789, 則.c/.cpp 檔名為 B123456789.c , 而壓縮檔名為 B123456789.rar。
無輸入輸出及逾期者一律以 0 分計算。


作業請上傳中山網路大學 網大上傳方式:
1. 點選要繳交的作業,選擇「進行作業」。


2. 依照流程上傳檔案。

More products