问题描述
- 资料结构
-
In this assignment, you will practice programming by using recursive algorithm. In addition, you need to know the fundamental file I/O, and how to use command line arguments.
Use a command line argument with designated input and output file names. Read a set of non- redundant characters that are separated by comma (,) and enclosed by parentheses ({ }) in the input file. Create a pointer of characters to save the elements given. Then print out all permutation of the given set in the output file as follows.
1. Anexampleofcommandline >p2_1 input.txt output.txt
2. An example of input (input.txt) {a,b,c}
3. Corresponding output (output.txt)
{a,b,c} {a,c,b} {b,a,c} {b,c,a} {c,b,a} {c,a,b}
4. Conditions :- The element is one character.
- The maximum number of elements in a set is 100.
- You should use recursive algorithm.
中文翻译
在这个任务中,您将使用递归算法进行编程。另外,你需要知道我的基本文件,以及如何使用命令行参数。
使用指定输入和输出文件名的命令行参数。在输入文件中用逗号(,)和圆括号({ })所用的非冗余的字符集读取一组。创建一个字符的指针来保存给定的元素。然后打印输出文件中给定集合的所有置换如下。
1。anexampleofcommandline > p2_1 input.txt output.txt
2。输入一个例子(输入.txt){ A,B,C }
3。相应的输出(输出.txt)
4。条件:
?元素是一个字符。
?集合中的元素的最大数目是100。
?你应该使用递归算法。
解决方案
http://c.biancheng.net/cpp/html/2573.html
时间: 2024-08-01 15:48:58