2 lylylytc lylylytc 于 2013.10.28 17:44 提问

如何在Linux下批量改C语言的作业?

最近接到导师给的一个任务帮本科生改C语言作业。大概的界面是这样的需要测试每种输入:

LuYang:CISB110-Programming Practice 1-41826 luyang$ ./main
Choose the type of speed conversion:
1. knots to km/h
2. km/h to knots
Enter your choice (1 or 2): 0
Invalid option
LuYang:CISB110-Programming Practice 1-41826 luyang$ ./main
Choose the type of speed conversion:
1. knots to km/h
2. km/h to knots
Enter your choice (1 or 2): 1
Enter the speed in knots: 2
2 knots = 3.7 km/h
LuYang:CISB110-Programming Practice 1-41826 luyang$ ./main
Choose the type of speed conversion:
1. knots to km/h
2. km/h to knots
Enter your choice (1 or 2): 2
Enter the speed in km/h: 4
4 km/h = 2.2 knots

有没有办法在linux下写一个脚本。然后将所有的测试结果都写入一个文件中?

Csdn user default icon
上传中...
上传图片
插入图片