文件名称:23
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:597byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
2、递归输出
【问题描述】
给定一个整数n,1≤n≤20,要求设计一个递归算法,实现下面两种方式(下三角和上三角)的文件输出。
n n n ... n 1
…… 2 2
3 3 3 3 3 3
2 2 ……
1 n n n … n
要求:输出形式可用户选择;数字之间采用TAB键隔开(使用’\t’)。
【输入数据】
输入数据由3.txt给出,文件格式为:第一行是一个整数n;第二行是一个整数,表示输出方式,取值0/1分别表示下三角/上三角。
【输出数据】
输出数据由4.txt给出,按照上述格式输出到文件中。
【实现提示】
本题是对递归算法的初步考察,了解递归函数的三个执行特点:
(1)函数名相同;
(2)不断地自调用;
(3)最后被调用的函数,要最先被返回。
4-2, recursive output
[Problem Descr iption]
Given an integer n, 1 ≤ n ≤ 20, to design a recursive algorithm to achieve the following two methods (lower triangular and upper triangular) file output.
n n n ... n 1
... ... 22
333 333
22 ... ...
1 n n n ... n
Requirements: the user can choose output format between numbers separated by using the TAB key (use \ t ).
[Input data]
3.txt given by the input data, file format: The first line is an integer n the second line is an integer, said output, value 0/1, respectively, lower triangular/upper triangular.
[Output data]
Output data from the 4.txt given, in accordance with the format of the output to a file.
[Prompt] to achieve
The problem is the recursive algorithm of the initial visit to look into the implementation of a recursive function of three characteristics:
(1) the same function name
(2) continuously since the call
(3) Finally, the function is called, to be the first to be returned.
4
【问题描述】
给定一个整数n,1≤n≤20,要求设计一个递归算法,实现下面两种方式(下三角和上三角)的文件输出。
n n n ... n 1
…… 2 2
3 3 3 3 3 3
2 2 ……
1 n n n … n
要求:输出形式可用户选择;数字之间采用TAB键隔开(使用’\t’)。
【输入数据】
输入数据由3.txt给出,文件格式为:第一行是一个整数n;第二行是一个整数,表示输出方式,取值0/1分别表示下三角/上三角。
【输出数据】
输出数据由4.txt给出,按照上述格式输出到文件中。
【实现提示】
本题是对递归算法的初步考察,了解递归函数的三个执行特点:
(1)函数名相同;
(2)不断地自调用;
(3)最后被调用的函数,要最先被返回。
4-2, recursive output
[Problem Descr iption]
Given an integer n, 1 ≤ n ≤ 20, to design a recursive algorithm to achieve the following two methods (lower triangular and upper triangular) file output.
n n n ... n 1
... ... 22
333 333
22 ... ...
1 n n n ... n
Requirements: the user can choose output format between numbers separated by using the TAB key (use \ t ).
[Input data]
3.txt given by the input data, file format: The first line is an integer n the second line is an integer, said output, value 0/1, respectively, lower triangular/upper triangular.
[Output data]
Output data from the 4.txt given, in accordance with the format of the output to a file.
[Prompt] to achieve
The problem is the recursive algorithm of the initial visit to look into the implementation of a recursive function of three characteristics:
(1) the same function name
(2) continuously since the call
(3) Finally, the function is called, to be the first to be returned.
4
(系统自动生成,下载前可以参看下载内容)
下载文件列表
23.cpp
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.