- 1、本文档共30页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
习题六 (解答)(Problem six (answer))
习题六 (解答)(Problem six (answer))
One choice question
1 C 2 B 3 A 4 D 5 D
6 B 7 is correct 8 A 9 D 10 A
11 A 12 B 13 D 14 A 15 B
Two fill in the blanks
1 sort by line
22, 4
3 character array
4 the first element address of the array
50
6159
2610
3711
4812
In 7 hours
*
*
*
*
In 8 hours
*
*
*
*
Nine
One
21
331
4641
10 A
B
C
D
E
11 i=1 x[i-1]
12, int, flag, I, scanf (%s, STR1), str[i], =str1[i]
13, i=10-j, a[i]a[i+1], t=a[i], a[i+1]=t
Three programming questions
One
#include stdio.h
Void, main ()
{
Int, I, n=0;
Int a[10]; / * the definition of an array used to store the number 10.
Float avg=0; / * define a variable, the average value is used to store the number of 10.
Int, Max, min;
Printf (please input 10 numbers: \n); / * * / prompt input number 10
/ * read 10 numbers, and these numbers and.
For (i=0; i10; i++)
{
Scanf (%d, a[i]);
}
Max=min=a[0];
For (i=1; i10; i++)
{
If (a[i]max)
{
Max=a[i];
}
If (a[i]min)
{
Min=a[i];
}
Avg+=a[i];
}
Avg/=10;
Printf (maximum value is%d, minimum value is%d: average value is:%f), Max, min, AVG);
}
Two
#include stdio.h
Void, main ()
{
Int, I, temp, n=0, k=0;
Int a[10]; / * the definition of an array used to store the number 10.
Int min;
Printf (please input 10 numbers: \n); / * * / prompt input number 10
/ * read 10 numbers, and these numbers and.
For (i=0; i10; i++)
{
Scanf (%d, a[i]);
}
Min=a[0];
For (i=1; i10; i++)
{
If (a[i]min)
{
Min=a[i];
K=i;
}
}
If (k, =0)
{
Temp=a[0];
A[0]=a[k];
A[k]=temp;
}
Printf (the final array is: \n);
For (i=0; i10; i++)
Printf (%d, a[i]);
Printf (\n minimum is:%d, subscript =%d, Min, K);
}
Three
# include stdio.h
# define N 6
Main ()
{int, a[N][N]={0}, i=0, j=0;
For (i=0; iN; i++)
A[i][0]=a[i][i]=1; / * to the first column and the diagonal elements of fu * 1
For (i=2; iN; i++)
For (j=1; ji; j++) / * diagonal elements have been assigned, so ji.
A[i][j]=a[i-1][j-1]+a[i-1][j]; / * * / assignment to other elements
For (i=0; iN; i++)
{for (j=0; j=i; j++) printf (%5d, a[i][j]);
Printf (\n);
}
}
Four
[solutions] pr
您可能关注的文档
- 乐华世界杯之旅回望(Leroy World Cup tour back).doc
- 义乌最全最精进货攻略(Yiwu's most comprehensive purchase of the most sophisticated Raiders).doc
- 乒乓球专业术语(Table tennis terminology).doc
- 乌兰察布副市长严洪波强调重点发展(Yan Hongbo, vice mayor of Wulanchabu, stressed the importance of development).doc
- 乔布斯带给我们的三堂必修课!(Jobs gave us three required courses!).doc
- 乔布斯精彩语录成为坟墓中的富豪毫无意义(Jobs's wonderful quote being a rich man in the grave makes no sense.).doc
- 乙烯-醋酸乙烯酯共聚物(eva)类热熔胶粘剂(Ethylene vinyl acetate copolymer (EVA) type hot melt adhesive).doc
- 乡镇应急工作计划(Township emergency work plan).doc
- 买婚纱攻略(Wedding dress introduction).doc
- 买菜技巧(Shopping skills).doc
文档评论(0)