文件名称:homework_2.22
介绍说明--下载内容均来自于网络,请自行研究使用
对单链表实现就地逆置,即利用原表的存储空间将线性表(a1,a2,…,an)逆置为(an,an-1,…,a1)。输入数据:文本文件input.txt
文件分2行:
第1行是单链表的数据元素个数n,n<20。如果n<1或n>19则视为输入数据出错。
第2行是单链表的n个数据元素,每个元素都是-999~999之间的十进制整数,元素之间用空格分开。
输出数据:文件output.txt
文件只有1行:
第1行是完成逆置之后的单链表n个元素的十进制整数,每个元素之间用空格分开。
如果输入数据出错,或者运行过程出错、问题无解等,则第1行输出字符串“ERROR”。
-Single linked list implementation situ reverse position, namely the use of the storage space of the original tables linear table (a1, a2, ..., an) inverse set (an, an-1, ..., a1). Input data: text file input.txt file sub 2 lines: Line 1 is the number of a single list of data elements n, n < 20. If n < 1 or n> 19 is considered to input data error. The second line is a single-chain n data elements, and each element is a decimal integer between-999 to 999, separated by a space between the elements. Output data: file output.txt file has only one line: Line 1 is set after the completion of the reverse single linked list of n decimal integer elements, separated by a space between each element. If the input data error, or an error during the operation, the problem has no solution, etc., then the first line of the output string " ERROR" .
文件分2行:
第1行是单链表的数据元素个数n,n<20。如果n<1或n>19则视为输入数据出错。
第2行是单链表的n个数据元素,每个元素都是-999~999之间的十进制整数,元素之间用空格分开。
输出数据:文件output.txt
文件只有1行:
第1行是完成逆置之后的单链表n个元素的十进制整数,每个元素之间用空格分开。
如果输入数据出错,或者运行过程出错、问题无解等,则第1行输出字符串“ERROR”。
-Single linked list implementation situ reverse position, namely the use of the storage space of the original tables linear table (a1, a2, ..., an) inverse set (an, an-1, ..., a1). Input data: text file input.txt file sub 2 lines: Line 1 is the number of a single list of data elements n, n < 20. If n < 1 or n> 19 is considered to input data error. The second line is a single-chain n data elements, and each element is a decimal integer between-999 to 999, separated by a space between the elements. Output data: file output.txt file has only one line: Line 1 is set after the completion of the reverse single linked list of n decimal integer elements, separated by a space between each element. If the input data error, or an error during the operation, the problem has no solution, etc., then the first line of the output string " ERROR" .
(系统自动生成,下载前可以参看下载内容)
下载文件列表
homework_2.22\homework_2.22参考答案一.c
.............\input.txt
.............\output.txt
homework_2.22