- 2
- 0
- 约 23页
- 2017-06-05 发布于河南
- 举报
实验8.1 指针与数组(国外英文资料)
实验8.1 指针与数组
Experiment 8.1 and array
Subject information table
The name of the serial number title is numbered
Circular movement (debug sample error08_1)
Find the specified element in the array
Use the selection method of functions
4 number off
Circular movement (debug sample error08_1)
# include stdio, h
Int main (void)
{
Int I, m, n, k, j;
Int a, [80].
Scanf ( % d % d );
For (I = 0; I n; I + +)
Scanf ( % d, );
For (I = 0; I m + +) {
K = a, [n - 1].
For (j = n minus 1; j ; j --)
A [j] = a [j-1];
A [0] = k;
}
/ * - the program fills in the blank and does not change the statement associated with the input output.
Enter two positive integers n and m (1 m n = 10), and then input n integers, the number of line, to the right loop m a mobile location (removed from the right number again from moving from the left).
The final output is n integers.
Requirements definition and call the function mov (x, n, m) can realize the function of the circular movement, function parameters of x type is integer pointer, parameter n and m is of type int, function of type is void.
Input/output example: in parentheses
Input:
5, 3 (n = 5, m = 3)
1, 2, 3, 4, 5 (5 integers)
Output:
After move: 3, 4, 5, 1, 2
-- * /
Printf ( After move: );
For (I = 0; I n; I + +)
Printf ( % d , a [I]);
Printf ( \ n );
Return 0;
}
Find the specified element in the array
# include stdio, h
Int main (void)
{
Int I, n, res, x;
Int repeat, ri;
Int a, [10].
Scanf ( % d , repeat);
For (ri = 1;)
Scanf ( % d , n);
For (I = 0; I n; I + +)
Scanf ( % d, );
Scanf ( % d , x);
Res = 1;
For (I = 0; I n; I + +)
If (a [I] = = x) {
Res = I;
Break;
}
/ * - the program fills in the blanks and does not change the statements associated with the input output.
Enter a positive integer repeat (0 repeat 10) and do the following operation:
Enter a positive integer n (1 n = 10), then input n integers into array a, enter an integer x, find x in array a,
If you find the minimum index of the corresponding element, output Not
您可能关注的文档
最近下载
- 明代宗教信仰与思想控制.docx VIP
- 江苏省南通市2024-2025学年高二上学期期末学业质量监测语文试卷(含答案).pdf VIP
- 国就有成人演出的电影了?想看就要冒生命危险.pdf VIP
- 综合素质练习题及答案.doc VIP
- 2020-2021学年北京高三化学二轮复习 反应原理型简答题(突破二卷)(word版 含答案).docx VIP
- 电力拖动控制线路安装与检修(白银矿冶职业技术学院)知到智慧树答案.docx VIP
- 煤炭巷道掘砌工(高级工)资格考试题库(全真题库).docx VIP
- 影像叙事中情感共鸣生成机制.docx VIP
- 同轴二级圆柱齿轮减速器的设计(硬齿面).doc VIP
- 基于GPU多线程多通道图像高速重构方法、设备及介质.pdf VIP
原创力文档

文档评论(0)