目录
整数排序题 ............................................................................................................................................... 4
☆题目1(整数排序题) ...................................................................................................................... 4 ☆题目2 正整数排序 ......................................................................................................................... 4 ★☆题目3(整数统计排序题)............................................................................................................ 5 ☆题目4(整数统计排序题) ............................................................................................................... 5 题目5(整数运算排序题) ................................................................................................................ 6 ★题目6(整数各位统计排序题)...................................................................................................... 6 题目7(整数统计排序题) ................................................................................................................ 7 ★题目8(整数排序题).................................................................................................................... 7 ★题目9(整数各位数字运算排序题) ................................................................................................. 8 题目10(整数各位数运算排序题) .................................................................................................... 8 ★☆题目11 (整数各位数运算及排序题) ........................................................................................ 9 整数统计运算题 ........................................................................................................................................ 9
★☆题目12整数统计运算题) ............................................................................................................ 9 ☆题目13(整数统计运算题) ........................................................................................................... 10
☆题目14(整数统计运算题) ......................................................................................................... 10 题目15(整数统计运算题) .............................................................................................................11 题目16(整数统计运算题) .............................................................................................................11 题目17(整数统计运算题) ............................................................................................................ 12 ☆题目18(整数统计运算题) ......................................................................................................... 12 题目19(整数统计运算题) ............................................................................................................ 12 题目20(整数各位数字运算题) ........................................................................................................ 13 ☆题目21(整数各位数字运算题 ) ................................................................................................ 13 题目22(整数各位数字运算题 ).................................................................................................... 14 ☆题目23(整数各位数字运算题) .................................................................................................. 14 题目24(整数各位数字运算题) ..................................................................................................... 15 ☆题目25(整数各位数字统计运算题) ........................................................................................... 15 ★☆题目26(整数各位运算题) ..................................................................................................... 15 题目27(整数各位数运算题) ......................................................................................................... 16 ☆题目28(整数各位数运算题) ..................................................................................................... 16 ☆题目29(整数各位运算统计题) .................................................................................................. 17 ☆题目30 ........................................................................................................................................ 18 题目31 ............................................................................................................................................ 18 整数各位打散组合运算题 ........................................................................................................................ 19
★☆题目32(整数各位打散组合运算题) .......................................................................................... 19
☆题目33(整数各位打散组合运算题) ............................................................................................. 19 ★☆题目34(整数各位打散组合运算题) ....................................................................................... 20 题目35(整数各位打散组合运算题) .............................................................................................. 20 ★题目36(整数各位打散组合运算题题) ....................................................................................... 21 题目37(整数各位打散组合运算题) .............................................................................................. 22 ★题目38(整数各位打散组合运算题) ........................................................................................... 22
第 1 页 共 55 页
题目39(整数各位打散组合运算题) .............................................................................................. 23 素数题 .................................................................................................................................................... 23
题目40(素数题) ............................................................................................................................. 23 题目41(素数统计排序题) ............................................................................................................ 24 ★☆题目42(素数题) ................................................................................................................... 24 ★题目43(素数题) ....................................................................................................................... 25 ★题目44(素数题) ....................................................................................................................... 26 ★题目45(数字运算题) ................................................................................................................ 26 ★题目46(数字统计排序题 ) ....................................................................................................... 27 ☆题目47(数字统计排序题 ) ....................................................................................................... 27 字符型题 ................................................................................................................................................ 28
题目48字符型题 ............................................................................................................................. 28
★题目49(字符处理——倒序输出) .............................................................................................. 29 ★题目50(字符排序题) ................................................................................................................ 29 ★☆题目51(替换字符题) ............................................................................................................... 30 ☆题目52(亲朋字符替换题) ......................................................................................................... 30 字符串处理题 ......................................................................................................................................... 31
★☆题目53(字符串排序题) ........................................................................................................... 31 ☆题目54(字符串字母移位题) ........................................................................................................ 32 ★☆题目55(字符串左右排序交换题 ) ......................................................................................... 32 题目56(字符串左右排序交换题 ) ................................................................................................ 33 ★题目57(字符串移位题) ............................................................................................................ 33 题目58(字符串排序题) ................................................................................................................ 34 ★题目59(字符串左右排序题) ..................................................................................................... 34 ★题目60(字符ASCII值移位替换题)........................................................................................... 35 方差运算题 ............................................................................................................................................. 36
★☆题目61(方差运算题) ............................................................................................................... 36 ☆题目62(方差运算题) ................................................................................................................ 36
☆题目63(方差运算题) ................................................................................................................ 37 ☆题目64(整数各位数运算题) ..................................................................................................... 38 ★题目65(字符替换题) .................................................................................................................. 38 ★☆题目66(字符替换题) ............................................................................................................... 39 ★题目67(字符替换题) .................................................................................................................. 39 题目68(字符替换题) ...................................................................................................................... 39 题目69(字符替换题) ................................................................................................................... 40 ☆题目70(字符替换题) ................................................................................................................ 40 ★题目71( 字符替换题) .............................................................................................................. 41 ☆题目72(字符替换题) ................................................................................................................ 41 ☆题目73(字符替换题) ................................................................................................................ 42 ★题目74(字符替换题) ................................................................................................................ 42 ★题目75(字符替题) ................................................................................................................... 42 ★☆题目76(字符替换题) ............................................................................................................ 43 ☆题目77(结构体操作题) ............................................................................................................... 43 ★☆题目78(结构体运算题题) ........................................................................................................ 44 题目79(结构体运算题) ................................................................................................................ 44 ★☆题目80(结构体运算题) ........................................................................................................... 44
第 2 页 共 55 页
☆题目81(结构体运算题) ............................................................................................................... 45 题目82(结构体运算题) .................................................................................................................. 45 题目83 结构体运算题 ..................................................................................................................... 45 题目84(结构体运算题 ) .............................................................................................................. 46 ★题目85(结构体运算题) ............................................................................................................ 46 题目86(结构体排列题) ................................................................................................................ 47 选票问题 ................................................................................................................................................ 47
题目87(选票问题) ....................................................................................................................... 47
★☆题目88(选票问题) .................................................................................................................. 48 ☆题目89(选票问题) ................................................................................................................... 48 ★☆题目90(级数运算题) ............................................................................................................... 49 其他问题 ................................................................................................................................................ 49
☆题目91(单词个数统计题) ........................................................................................................... 49 ★题目92(Fibonacci数列题)........................................................................................................... 50 ☆题目93(迭代方法求方程题) ........................................................................................................ 50 ★题目94(平方根问题) .................................................................................................................. 51 题目95 (实数运算题) ....................................................................................................................... 52 题目96(完全平方数问题) ............................................................................................................... 53 ★题目97 (回文数问题) .............................................................................................................. 53 ★题目98(出圈题) ....................................................................................................................... 54 ☆题目99(SIX/NINE问题) ............................................................................................................. 54
第 3 页 共 55 页
三级网络上机题型
整数排序题
☆题目1(整数排序题)
在文件in.dat中有200个正整数,且每个数均在1000至9999之间。函数ReadDat()读取这200个数存放到数组aa中。请编制函数jsSort(),其函数的功能是:要求按每个数的后三位的大小进行升序排列,然后取出满足此条件的前10个数依次存入数组bb中,如果后三位的数值相等,则按原先的数值进行降序排列。最后调用函数WriteDat()把结果bb输出到文件out.dat中。
例:处理前 6012 5099 9012 7025 8088 处理后 9012 6012 7025 8088 5099 void jsSort() {
int i,j,data;
for(i=0;i<199;i++)
for(j=i+1;j<200;j++)
if(aa[i]00>aa[j]00||aa[i]00==aa[j]00&&aa[i] ****************************************************************************** ☆题目2 正整数排序 在文件in.dat中有200个正整数,且每个数均在1000至9999之间。函数ReadDat()读取这200个数存放到数组aa中。请编制函数jsSort(),其函数的功能是:要求按每个数的后三位的大小进行降序排列,然后取出满足此条件的前10个数依次存入数组b中,如果后三位的数值相等,则按原先的数值进行升序排列。最后调用函数WriteDat()把结果bb输出到文件out.dat中。 例:处理前 9012 5099 6012 7025 8088 处理后 5099 8088 7025 6012 9012 void jsSort() { int i,j,data; for(i=0;i<199;i++) for(j=i+1;j<200;j++) if(aa[i]00 第 4 页 共 55 页 *************************************************************************** ★☆题目3(整数统计排序题) 已知数据文件IN.DAT中存有200个四位数,并已调用读函数readDat()把这些数存入数组a中,请考生编制一函数jsVal(),其功能是:依次从数组a中取出一个四位数,如果该四位数连续大于该四位数以后的五个数且该数是奇数(该四位数以后不满五个数,则不统计),则统计出满足此条件的个数cnt并把这些四位数按从小到大的顺序存入数组b中,最后调用写函数writeDat( )把结果cnt以及数组b中符合条件的四位数输出到OUT.DAT文件中。 void jsVal() {int i,j,flag; for(i=0;i if(a[i]>a[j]&&a[i]%2) flag=1; else {flag=0;break;} if(flag==1) b[cnt++]=a[i]; } for(i=0;i for(j=i+1;j if(b[i]>b[j]) {flag=b[i];b[i]=b[j];b[j]=flag;} } ********************************************************************* ☆题目4(整数统计排序题) 已知数据文件IN.DAT中存有200个四位数,并已调用读函数readDat()把这些数存入数组a中,请考生编制一函数jsVal(),其功能是:依次从数组a中取出一个四位数,如果该四位数连续小于该四位数以后的五个数且该数是偶数(该四位数以后不满五个数,则不统计),则统计出满足此条件的个数cnt并把这些四位数按从小到大的顺序存入数组b中,最后调用写函数writeDat( )把结果cnt以及数组b中符合条件的四位数输出到OUT.DAT文件中。 void jsVal() {int i,j,flag; for(i=0;i {for(j=i+1;j<=i+5;j++)