第2题
例如,一维数组中的原始内容为1,2,3,4,5,6,7, 8,9,10,11,12,13,14,15,p的值为6。移动后,一维数组中的内容应为7,8,9,10, 11,12,13,14,15,1, 2, 3, 4, 5, 6。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
include<stdio.h>
define N 80
void fun(int *w,int p,int n)
{
}
main()
{
int a[N]={1,2,3,4,5,6,7,8,9,10,11, 12,13,14,15};
int i,p,n=15;
printf("The original data:\n");
for(i=0;i<n;i++)
printf("%3d",a[i]);
printf("\n\nEnter p:");
scanf("%d",&p);
fun(a,p,n);
printf("\nThe data after moving:\n");
for(i=0;i<n;i++)
printf("%3d",a[i]);
printf("\n\n");
}
第3题
例如,一维数组中的原始内容为1,2,3,4,5,6,7, 8,9,10,11,12,13,14,15,p的值为3。移动后,一维数组中的内容应为5,6,7,8,9,10,11,12,13,14,15, 1, 2, 3, 4。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
include <stdio.h>
define N 80
void fun(int *w, int p, int n)
{
}
main ()
{
int a[N]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int i, p, n=15;
printf("The original data:\n");
for(i=0;i<n;i++)
printf("%3d",a[i]);
printf("\n\nEnter p: ");
scanf("%d",&p);
fun(a,p,n);
printf("\nThe data after moving:\n");
for(i=0;i<n;i++)
printf("%3d",a[i]);
printf("\n\n");
}
第6题
第7题
第8题
第9题
寻找最大数 题目内容: 主函数定义一个长度为5的整型一维数组,编写一个函数实现求此一维数组的最大值。函数 原型:int max(int a[], int n); 功能是返回长度为n的数组a中最大的一个数。 输入格式: 5个整数 输出格式: "The result is %d\n" 输入样例1: 12 6 18 9 4↙ 输出样例1: The_result_is_18 输入样例2: 9 7 -2 3 4↙ 输出样例2: The_result_is_9
第10题
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!