动态网站制作指南
[  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
电脑书籍下载:程序设计书籍 | 数据库教程书籍 | 平面与多媒体书籍 | 网络通讯书籍 | 系统管理书籍 | 网络安全书籍 | 认证考试书籍
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 认证考试 > 全国等级考试
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ 全国等级考试 ]的信息

本月文章推荐
.1996年全国计算机等级考试四级试.
.上海市全国计算机等级考试考点.
.1996年9月全国计算机等级考试二级.
.了解考试系列:一级MS Office的软.
.全国计算机等级二级C语言上机改错.
.07年4月计算机等级二级VF模拟笔试.
.2003年下半年全国计算机等级考试.
.2002年4月全国计算机等级考试二级.
.如何在考生目录下进入编程环境.
.全国计算机等级考试四级复习纲要.
.2002年9月全国计算机等级考试二级.
.考全国计算机等级考试三级如何学.
.计算机四级考试通关之心得体会和.
.全国计算机等级考试四级考试笔试.
.全国计算机等级考试四级考试中英.
.2002年9月全国三级数据库技术试卷.
.2002年全国计算机等级考试四级考.
.全国计算机等级考试二级Visual B.
.07年4月计算机等级二级VF模拟笔试.
.从一级到四级 全国计算机等级考试.

全国计算机等级考试四级上机编程题型

文章类别:全国等级考试 | 发表日期:2005-4-14 |





第一套

===============================================================================
试题说明 :
===============================================================================
 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整
数, 函数ReadDat( )是读取这若干个正整数并存入数组xx中。请
编制函数CalValue( ), 其功能要求: 1. 求出这文件中共有多少
个正整数totNum; 2.求出这些数中的各位数字之和是奇数的数的
个数totCnt, 以及满足此条件的这些数的算术平均值totPjz, 最
后调用函数WriteDat()把所求的结果输出到文件OUT1.DAT中。
 注意: 部分源程序存放在PROG1.C中。
 请勿改动主函数main( )、读数据函数ReadDat()和输出数据
函数WriteDat()的内容。
===============================================================================
程序 :
===============================================================================
#include
#include
#define MAXNUM 200

int xx[MAXNUM] ;
int totNum = 0 ; /* 文件IN.DAT中共有多少个正整数 */
int totCnt = 0 ; /* 符合条件的正整数的个数 */
double totPjz = 0.0 ; /* 平均值 */

int ReadDat(void) ;
void WriteDat(void) ;

void CalValue(void)
{



}

void main()
{
 clrscr() ;
 if(ReadDat()) {
 printf("数据文件IN.DAT不能打开!\007\n") ;
 return ;
 }
 CalValue() ;
 printf("文件IN.DAT中共有正整数=%d个\n", totNum) ;
 printf("符合条件的正整数的个数=%d个\n", totCnt) ;
 printf("平均值=%.2lf\n", totPjz) ;
 WriteDat() ;
}

int ReadDat(void)
{
 FILE *fp ;
 int i = 0 ;

 if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
 while(!feof(fp)) {
 fscanf(fp, "%d,", &xx[i++]) ;
 }
 fclose(fp) ;
 return 0 ;
}

void WriteDat(void)
{
 FILE *fp ;

 fp = fopen("OUT1.DAT", "w") ;
 fprintf(fp, "%d\n%d\n%.2lf\n", totNum, totCnt, totPjz) ;
 fclose(fp) ;
}
===============================================================================
所需数据 :
===============================================================================
@2 IN.DAT 016
6045,6192,1885,3580,8544,6826,5493,8415,3132,5841,
6561,3173,9157,2895,2851,6082,5510,9610,5398,5273,
3438,1800,6364,6892,9591,3120,8813,2106,5505,1085,
5835,7295,6131,9405,6756,2413,6274,9262,5728,2650,
6266,5285,7703,1353,1510,2350,4325,4392,7573,8204,
7358,6365,3135,9903,3055,3219,3955,7313,6206,1631,
5869,5893,4569,1251,2542,5740,2073,9805,1189,7550,
4362,6214,5680,8753,8443,3636,4495,9643,3782,5556,
1018,9729,8588,2797,4321,4714,9658,8997,2080,5912,
9968,5558,9311,7047,6138,7618,5448,1466,7075,2166,
4025,3572,9605,1291,6027,2358,1911,2747,7068,1716,
9661,5849,3210,2554,8604,8010,7947,3685,2945,4224,
7014,9058,6259,9503,1615,1060,7787,8983,3822,2471,
5146,7066,1029,1777,7788,2941,3538,2912,3096,7421,
9175,6099,2930,4685,8465,8633,2628,7155,4307,9535,
4274,2857,6829,6226,8268,9377,9415,9059,4872,6072,
#E
@3 $OUT1.DAT 003
|160\|69\|5460.51
#E

第二套

===============================================================================
试题说明 :
===============================================================================
 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整
数, 函数ReadDat( )是读取这若干个正整数并存入数组xx中。请
编制函数CalValue( ), 其功能要求: 1. 求出这文件中共有多少
个正整数totNum; 2.求出这些数中的各位数字之和是偶数的数的
个数totCnt, 以及满足此条件的这些数的算术平均值totPjz, 最
后调用函数WriteDat()把所求的结果输出到文件OUT2.DAT中。
 注意: 部分源程序存放在PROG1.C中。
 请勿改动主函数main( )、读数据函数ReadDat()和输出数据
函数WriteDat()的内容。
===============================================================================
程序 :
===============================================================================
#include
#include
#define MAXNUM 200

int xx[MAXNUM] ;
int totNum = 0 ; /* 文件IN.DAT中共有多少个正整数 */
int totCnt = 0 ; /* 符合条件的正整数的个数 */
double totPjz = 0.0 ; /* 平均值 */

int ReadDat(void) ;
void WriteDat(void) ;

void CalValue(void)
{



}

void main()
{
 clrscr() ;
 if(ReadDat()) {
 printf("数据文件IN.DAT不能打开!\007\n") ;
 return ;
 }
 CalValue() ;
 printf("文件IN.DAT中共有正整数=%d个\n", totNum) ;
 printf("符合条件的正整数的个数=%d个\n", totCnt) ;
 printf("平均值=%.2lf\n", totPjz) ;
 WriteDat() ;
}

int ReadDat(void)
{
 FILE *fp ;
 int i = 0 ;

 if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
 while(!feof(fp)) {
 fscanf(fp, "%d,", &xx[i++]) ;
 }
 fclose(fp) ;
 return 0 ;
}

void WriteDat(void)
{
 FILE *fp ;

 fp = fopen("OUT2.DAT", "w") ;
 fprintf(fp, "%d\n%d\n%.2lf\n", totNum, totCnt, totPjz) ;
 fclose(fp) ;
}
===============================================================================
所需数据 :
===============================================================================
@2 IN.DAT 016
6045,6192,1885,3580,8544,6826,5493,8415,3132,5841,
6561,3173,9157,2895,2851,6082,5510,9610,5398,5273,
3438,1800,6364,6892,9591,3120,8813,2106,5505,1085,
5835,7295,6131,9405,6756,2413,6274,9262,5728,2650,
6266,5285,7703,1353,1510,2350,4325,4392,7573,8204,
7358,6365,3135,9903,3055,3219,3955,7313,6206,1631,
5869,5893,4569,1251,2542,5740,2073,9805,1189,7550,
4362,6214,5680,8753,8443,3636,4495,9643,3782,5556,
1018,9729,8588,2797,4321,4714,9658,8997,2080,5912,
9968,5558,9311,7047,6138,7618,5448,1466,7075,2166,
4025,3572,9605,1291,6027,2358,1911,2747,7068,1716,
9661,5849,3210,2554,8604,8010,7947,3685,2945,4224,
7014,9058,6259,9503,1615,1060,7787,8983,3822,2471,
5146,7066,1029,1777,7788,2941,3538,2912,3096,7421,
9175,6099,2930,4685,8465,8633,2628,7155,4307,9535,
4274,2857,6829,6226,8268,9377,9415,9059,4872,6072,
#E
@3 $OUT2.DAT 003
|160\|91\|5517.16
#E

第三套

===============================================================================
试题说明 :
===============================================================================
 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整
数, 函数ReadDat( )是读取这若干个正整数并存入数组xx中。请
编制函数CalValue( ), 其功能要求: 1. 求出这文件中共有多少
个正整数totNum; 2. 求这些数右移1位后, 产生的新数是奇数的
数的个数totCnt, 以及满足此条件的这些数(右移前的值)的算术
平均值totPjz, 最后调用函数WriteDat()把所求的结果输出到文
件OUT3.DAT中。
 注意: 部分源程序存放在PROG1.C中。
 请勿改动主函数main( )、读数据函数ReadDat()和输出数据
函数WriteDat()的内容。
===============================================================================
程序 :
===============================================================================
#include
#include
#define MAXNUM 200

int xx[MAXNUM] ;
int totNum = 0 ; /* 文件IN.DAT中共有多少个正整数 */
int totCnt = 0 ; /* 符合条件的正整数的个数 */
double totPjz = 0.0 ; /* 平均值 */

int ReadDat(void) ;
void WriteDat(void) ;

void CalValue(void)
{



}

void main()
{
 clrscr() ;
 if(ReadDat()) {
 printf("数据文件IN.DAT不能打开!\007\n") ;
 return ;
 }
 CalValue() ;
 printf("文件IN.DAT中共有正整数=%d个\n", totNum) ;
 printf("符合条件的正整数的个数=%d个\n", totCnt) ;
 printf("平均值=%.2lf\n", totPjz) ;
 WriteDat() ;
}

int ReadDat(void)
{
 FILE *fp ;
 int i = 0 ;

 if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
 while(!feof(fp)) {
 fscanf(fp, "%d,", &xx[i++]) ;
 }
 fclose(fp) ;
 return 0 ;
}

void WriteDat(void)
{
 FILE *fp ;

 fp = fopen("OUT3.DAT", "w") ;
 fprintf(fp, "%d\n%d\n%.2lf\n", totNum, totCnt, totPjz) ;
 fclose(fp) ;
}
===============================================================================
所需数据 :
===============================================================================
@2 IN.DAT 016
6045,6192,1885,3580,8544,6826,5493,8415,3132,5841,
6561,3173,9157,2895,2851,6082,5510,9610,5398,5273,
3438,1800,6364,6892,9591,3120,8813,2106,5505,1085,
5835,7295,6131,9405,6756,2413,6274,9262,5728,2650,
6266,5285,7703,1353,1510,2350,4325,4392,7573,8204,
7358,6365,3135,9903,3055,3219,3955,7313,6206,1631,
5869,5893,4569,1251,2542,5740,2073,9805,1189,7550,
4362,6214,5680,8753,8443,3636,4495,9643,3782,5556,
1018,9729,8588,2797,4321,4714,9658,8997,2080,5912,
9968,5558,9311,7047,6138,7618,5448,1466,7075,2166,
4025,3572,9605,1291,6027,2358,1911,2747,7068,1716,
9661,5849,3210,2554,8604,8010,7947,3685,2945,4224,
7014,9058,6259,9503,1615,1060,7787,8983,3822,2471,
5146,7066,1029,1777,7788,2941,3538,2912,3096,7421,
9175,6099,2930,4685,8465,8633,2628,7155,4307,9535,
4274,2857,6829,6226,8268,9377,9415,9059,4872,6072,
#E
@3 $OUT3.DAT 003
|160\|80\|5537.54
#E

第四套

===============================================================================
试题说明 :
===============================================================================
 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整
数, 函数ReadDat( )是读取这若干个正整数并存入数组xx中。请
编制函数CalValue( ), 其功能要求: 1. 求出这文件中共有多少
个正整数totNum; 2. 求这些数右移1位后, 产生的新数是偶数的
数的个数totCnt, 以及满足此条件的这些数(右移前的值)的算术
平均值totPjz, 最后调用函数WriteDat()把所求的结果输出到文
件OUT4.DAT中。
 注意: 部分源程序存放在PROG1.C中。
 请勿改动主函数main( )、读数据函数ReadDat()和输出数据
函数WriteDat()的内容。
===============================================================================
程序 :
===============================================================================
#include
#include
#define MAXNUM 200

int xx[MAXNUM] ;
int totNum = 0 ; /* 文件IN.DAT中共有多少个正整数 */
int totCnt = 0 ; /* 符合条件的正整数的个数 */
double totPjz = 0.0 ; /* 平均值 */

int ReadDat(void) ;
void WriteDat(void) ;

void CalValue(void)
{



}

void main()
{
 clrscr() ;
 if(ReadDat()) {
 printf("数据文件IN.DAT不能打开!\007\n") ;
 return ;
 }
 CalValue() ;
 printf("文件IN.DAT中共有正整数=%d个\n", totNum) ;
 printf("符合条件的正整数的个数=%d个\n", totCnt) ;
 printf("平均值=%.2lf\n", totPjz) ;
 WriteDat() ;
}

int ReadDat(void)
{
 FILE *fp ;
 int i = 0 ;

 if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
 while(!feof(fp)) {
 fscanf(fp, "%d,", &xx[i++]) ;
 }
 fclose(fp) ;
 return 0 ;
}

void WriteDat(void)
{
 FILE *fp ;

 fp = fopen("OUT4.DAT", "w") ;
 fprintf(fp, "%d\n%d\n%.2lf\n", totNum, totCnt, totPjz) ;
 fclose(fp) ;
}
===============================================================================
所需数据 :
===============================================================================
@2 IN.DAT 016
6045,6192,1885,3580,8544,6826,5493,8415,3132,5841,
6561,3173,9157,2895,2851,6082,5510,9610,5398,5273,
3438,1800,6364,6892,9591,3120,8813,2106,5505,1085,
5835,7295,6131,9405,6756,2413,6274,9262,5728,2650,
6266,5285,7703,1353,1510,2350,4325,4392,7573,8204,
7358,6365,3135,9903,3055,3219,3955,7313,6206,1631,
5869,5893,4569,1251,2542,5740,2073,9805,1189,7550,
4362,6214,5680,8753,8443,3636,4495,9643,3782,5556,
1018,9729,8588,2797,4321,4714,9658,8997,2080,5912,
9968,5558,9311,7047,6138,7618,5448,1466,7075,2166,
4025,3572,9605,1291,6027,2358,1911,2747,7068,1716,
9661,5849,3210,2554,8604,8010,7947,3685,2945,4224,
7014,9058,6259,9503,1615,1060,7787,8983,3822,2471,
5146,7066,1029,1777,7788,2941,3538,2912,3096,7421,
9175,6099,2930,4685,8465,8633,2628,7155,4307,9535,
4274,2857,6829,6226,8268,9377,9415,9059,4872,6072,
#E
@3 $OUT4.DAT 003
|160\|80\|5447.93
#E

第五套

===============================================================================
试题说明 :
===============================================================================
 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整
数, 函数ReadDat( )是读取这若干个正整数并存入数组xx中。请
编制函数CalValue( ), 其功能要求: 1. 求出这文件中共有多少
个正整数totNum; 2. 求这些数中的个位数位置上的数字是3、
6和9的数的个数totCnt, 以及满足此条件的这些数的算术平均
值totPjz, 最后调用函数WriteDat( )把所求的结果输出到文件
OUT5.DAT中。
 注意: 部分源程序存放在PROG1.C中。
 请勿改动主函数main( )、读数据函数ReadDat()和输出数据
函数WriteDat()的内容。
===============================================================================
程序 :
===============================================================================
#include
#include
#define MAXNUM 200

int xx[MAXNUM] ;
int totNum = 0 ; /* 文件IN.DAT中共有多少个正整数 */
int totCnt = 0 ; /* 符合条件的正整数的个数 */
double totPjz = 0.0 ; /* 平均值 */

int ReadDat(void) ;
void WriteDat(void) ;

void CalValue(void)
{



}

void main()
{
 clrscr() ;
 if(ReadDat()) {
 printf("数据文件IN.DAT不能打开!\007\n") ;
 return ;
 }
 CalValue() ;
 printf("文件IN.DAT中共有正整数=%d个\n", totNum) ;
 printf("符合条件的正整数的个数=%d个\n", totCnt) ;
 printf("平均值=%.2lf\n", totPjz) ;
 WriteDat() ;
}

int ReadDat(void)
{
 FILE *fp ;
 int i = 0 ;

 if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
 while(!feof(fp)) {
 fscanf(fp, "%d,", &xx[i++]) ;
 }
 fclose(fp) ;
 return 0 ;
}

void WriteDat(void)
{
 FILE *fp ;

 fp = fopen("OUT5.DAT", "w") ;
 fprintf(fp, "%d\n%d\n%.2lf\n", totNum, totCnt, totPjz) ;
 fclose(fp) ;
}
===============================================================================
所需数据 :
===============================================================================
@2 IN.DAT 016
6045,6192,1885,3580,8544,6826,5493,8415,3132,5841,
6561,3173,9157,2895,2851,6082,5510,9610,5398,5273,
3438,1800,6364,6892,9591,3120,8813,2106,5505,1085,
5835,7295,6131,9405,6756,2413,6274,9262,5728,2650,
6266,5285,7703,1353,1510,2350,4325,4392,7573,8204,
7358,6365,3135,9903,3055,3219,3955,7313,6206,1631,
5869,5893,4569,1251,2542,5740,2073,9805,1189,7550,
4362,6214,5680,8753,8443,3636,4495,9643,3782,5556,
1018,9729,8588,2797,4321,4714,9658,8997,2080,5912,
9968,5558,9311,7047,6138,7618,5448,1466,7075,2166,
4025,3572,9605,1291,6027,2358,1911,2747,7068,1716,
9661,5849,3210,2554,8604,8010,7947,3685,2945,4224,
7014,9058,6259,9503,1615,1060,7787,8983,3822,2471,
5146,7066,1029,1777,7788,2941,3538,2912,3096,7421,
9175,6099,2930,4685,8465,8633,2628,7155,4307,9535,
4274,2857,6829,6226,8268,9377,9415,9059,4872,6072,
#E
@3 $OUT5.DAT 003
|160\|43\|5694.58
#E

第六套

===============================================================================
试题说明 :
===============================================================================
 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整
数, 函数ReadDat( )是读取这若干个正整数并存入数组xx中。请
编制函数CalValue( ), 其功能要求: 1. 求出这文件中共有多少
个正整数totNum; 2. 求这些数中的十位数位置上的数字是2、
4和8的数的个数totCnt, 以及满足此条件的这些数的算术平均
值totPjz, 最后调用函数WriteDat( )把所求的结果输出到文件
OUT6.DAT中。
 注意: 部分源程序存放在PROG1.C中。
 请勿改动主函数main( )、读数据函数ReadDat()和输出数据
函数WriteDat()的内容。
===============================================================================
程序 :
===============================================================================
#include
#include
#define MAXNUM 200

int xx[MAXNUM] ;
int totNum = 0 ; /* 文件IN.DAT中共有多少个正整数 */
int totCnt = 0 ; /* 符合条件的正整数的个数 */
double totPjz = 0.0 ; /* 平均值 */

int ReadDat(void) ;
void WriteDat(void) ;

void CalValue(void)
{



}

void main()
{
 clrscr() ;
 if(ReadDat()) {
 printf("数据文件IN.DAT不能打开!\007\n") ;
 return ;
 }
 CalValue() ;
 printf("文件IN.DAT中共有正整数=%d个\n", totNum) ;
 printf("符合条件的正整数的个数=%d个\n", totCnt) ;
 printf("平均值=%.2lf\n", totPjz) ;
 WriteDat() ;
}

int ReadDat(void)
{
 FILE *fp ;
 int i = 0 ;

 if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
 while(!feof(fp)) {
 fscanf(fp, "%d,", &xx[i++]) ;
 }
 fclose(fp) ;
 return 0 ;
}

void WriteDat(void)
{
 FILE *fp ;

 fp = fopen("OUT6.DAT", "w") ;
 fprintf(fp, "%d\n%d\n%.2lf\n", totNum, totCnt, totPjz) ;
 fclose(fp) ;
}
===============================================================================
所需数据 :
===============================================================================
@2 IN.DAT 016
6045,6192,1885,3580,8544,6826,5493,8415,3132,5841,
6561,3173,9157,2895,2851,6082,5510,9610,5398,5273,
3438,1800,6364,6892,9591,3120,8813,2106,5505,1085,
5835,7295,6131,9405,6756,2413,6274,9262,5728,2650,
6266,5285,7703,1353,1510,2350,4325,4392,7573,8204,
7358,6365,3135,9903,3055,3219,3955,7313,6206,1631,
5869,5893,4569,1251,2542,5740,2073,9805,1189,7550,
4362,6214,5680,8753,8443,3636,4495,9643,3782,5556,
1018,9729,8588,2797,4321,4714,9658,8997,2080,5912,
9968,5558,9311,7047,6138,7618,5448,1466,7075,2166,
4025,3572,9605,1291,6027,2358,1911,2747,7068,1716,
9661,5849,3210,2554,8604,8010,7947,3685,2945,4224,
7014,9058,6259,9503,1615,1060,7787,8983,3822,2471,
5146,7066,1029,1777,7788,2941,3538,2912,3096,7421,
9175,6099,2930,4685,8465,8633,2628,7155,4307,9535,
4274,2857,6829,6226,8268,9377,9415,9059,4872,6072,
#E
@3 $OUT6.DAT 003
|160\|45\|5229.16
#E

第七套

===============================================================================
试题说明 :
===============================================================================
 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整
数, 函数ReadDat( )是读取这若干个正整数并存入数组xx中。请
编制函数CalValue( ), 其功能要求: 1. 求出这文件中共有多少
个正整数totNum; 2. 求这些数中的百位数位置上的数字是1、
5和7的数的个数totCnt, 以及满足此条件的这些数的算术平均
值totPjz, 最后调用函数WriteDat( )把所求的结果输出到文件
OUT7.DAT中。
 注意: 部分源程序存放在PROG1.C中。
 请勿改动主函数main( )、读数据函数ReadDat()和输出数据
函数WriteDat()的内容。
===============================================================================
程序 :
===============================================================================
#include
#include
#define MAXNUM 200

int xx[MAXNUM] ;
int totNum = 0 ; /* 文件IN.DAT中共有多少个正整数 */
int totCnt = 0 ; /* 符合条件的正整数的个数 */
double totPjz = 0.0 ; /* 平均值 */

int ReadDat(void) ;
void WriteDat(void) ;

void CalValue(void)
{



}

void main()
{
 clrscr() ;
 if(ReadDat()) {
 printf("数据文件IN.DAT不能打开!\007\n") ;
 return ;
 }
 CalValue() ;
 printf("文件IN.DAT中共有正整数=%d个\n", totNum) ;
 printf("符合条件的正整数的个数=%d个\n", totCnt) ;
 printf("平均值=%.2lf\n", totPjz) ;
 WriteDat() ;
}

int ReadDat(void)
{
 FILE *fp ;
 int i = 0 ;

 if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
 while(!feof(fp)) {
 fscanf(fp, "%d,", &xx[i++]) ;
 }
 fclose(fp) ;
 return 0 ;
}

void WriteDat(void)
{
 FILE *fp ;

 fp = fopen("OUT7.DAT", "w") ;
 fprintf(fp, "%d\n%d\n%.2lf\n", totNum, totCnt, totPjz) ;
 fclose(fp) ;
}
===============================================================================
所需数据 :
===============================================================================
@2 IN.DAT 016
6045,6192,1885,3580,8544,6826,5493,8415,3132,5841,
6561,3173,9157,2895,2851,6082,5510,9610,5398,5273,
3438,1800,6364,6892,9591,3120,8813,2106,5505,1085,
5835,7295,6131,9405,6756,2413,6274,9262,5728,2650,
6266,5285,7703,1353,1510,2350,4325,4392,7573,8204,
7358,6365,3135,9903,3055,3219,3955,7313,6206,1631,
5869,5893,4569,1251,2542,5740,2073,9805,1189,7550,
4362,6214,5680,8753,8443,3636,4495,9643,3782,5556,
1018,9729,8588,2797,4321,4714,9658,8997,2080,5912,
9968,5558,9311,7047,6138,7618,5448,1466,7075,2166,
4025,3572,9605,1291,6027,2358,1911,2747,7068,1716,
9661,5849,3210,2554,8604,8010,7947,3685,2945,4224,
7014,9058,6259,9503,1615,1060,7787,8983,3822,2471,
5146,7066,1029,1777,7788,2941,3538,2912,3096,7421,
9175,6099,2930,4685,8465,8633,2628,7155,4307,9535,
4274,2857,6829,6226,8268,9377,9415,9059,4872,6072,
#E
@3 $OUT7.DAT 003
|160\|47\|5448.32
#E

第八套

===============================================================================
试题说明 :
===============================================================================
 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整
数, 函数ReadDat( )是读取这若干个正整数并存入数组xx中。请
编制函数CalValue( ), 其功能要求: 1. 求出这文件中共有多少
个正整数totNum; 2. 求这些数中的千位数位置上的数字大于个
位数位置上的数字的数的个数totCnt, 以及满足此条件的这些数
的算术平均值totPjz, 最后调用函数WriteDat()把所求的结果输
出到文件OUT8.DAT中。
 注意: 部分源程序存放在PROG1.C中。
 请勿改动主函数main( )、读数据函数ReadDat()和输出数据
函数WriteDat()的内容。
===============================================================================
程序 :
===============================================================================
#include
#include
#define MAXNUM 200

int xx[MAXNUM] ;
int totNum = 0 ; /* 文件IN.DAT中共有多少个正整数 */
int totCnt = 0 ; /* 符合条件的正整数的个数 */
double totPjz = 0.0 ; /* 平均值 */

int ReadDat(void) ;
void WriteDat(void) ;

void CalValue(void)
{



}

void main()
{
 clrscr() ;
 if(ReadDat()) {
 printf("数据文件IN.DAT不能打开!\007\n") ;
 return ;
 }
 CalValue() ;
 printf("文件IN.DAT中共有正整数=%d个\n", totNum) ;
 printf("符合条件的正整数的个数=%d个\n", totCnt) ;
 printf("平均值=%.2lf\n", totPjz) ;
 WriteDat() ;
}

int ReadDat(void)
{
 FILE *fp ;
 int i = 0 ;

 if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
 while(!feof(fp)) {
 fscanf(fp, "%d,", &xx[i++]) ;
 }
 fclose(fp) ;
 return 0 ;
}

void WriteDat(void)
{
 FILE *fp ;

 fp = fopen("OUT8.DAT", "w") ;
 fprintf(fp, "%d\n%d\n%.2lf\n", totNum, totCnt, totPjz) ;
 fclose(fp) ;
}
===============================================================================
所需数据 :
===============================================================================
@2 IN.DAT 016
6045,6192,1885,3580,8544,6826,5493,8415,3132,5841,
6561,3173,9157,2895,2851,6082,5510,9610,5398,5273,
3438,1800,6364,6892,9591,3120,8813,2106,5505,1085,
5835,7295,6131,9405,6756,2413,6274,9262,5728,2650,
6266,5285,7703,1353,1510,2350,4325,4392,7573,8204,
7358,6365,3135,9903,3055,3219,3955,7313,6206,1631,
5869,5893,4569,1251,2542,5740,2073,9805,1189,7550,
4362,6214,5680,8753,8443,3636,4495,9643,3782,5556,
1018,9729,8588,2797,4321,4714,9658,8997,2080,5912,
9968,5558,9311,7047,6138,7618,5448,1466,7075,2166,
4025,3572,9605,1291,6027,2358,1911,2747,7068,1716,
9661,5849,3210,2554,8604,8010,7947,3685,2945,4224,
7014,9058,6259,9503,1615,1060,7787,8983,3822,2471,
5146,7066,1029,1777,7788,2941,3538,2912,3096,7421,
9175,6099,2930,4685,8465,8633,2628,7155,4307,9535,
4274,2857,6829,6226,8268,9377,9415,9059,4872,6072,
#E
@3 $OUT8.DAT 003
|160\|81\|6617.44
#E

第九套

===============================================================================
试题说明 :
===============================================================================
 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整
数, 函数ReadDat( )是读取这若干个正整数并存入数组xx中。请
编制函数CalValue( ), 其功能要求: 1. 求出这文件中共有多少
个正整数totNum; 2. 求这些数中的百位数位置上的数字小于十
位数位置上的数字的数的个数totCnt, 以及满足此条件的这些数
的算术平均值totPjz, 最后调用函数WriteDat()把所求的结果输
出到文件OUT9.DAT中。
 注意: 部分源程序存放在PROG1.C中。
 请勿改动主函数main( )、读数据函数ReadDat()和输出数据
函数WriteDat()的内容。
===============================================================================
程序 :
===============================================================================
#include
#include
#define MAXNUM 200

int xx[MAXNUM] ;
int totNum = 0 ; /* 文件IN.DAT中共有多少个正整数 */
int totCnt = 0 ; /* 符合条件的正整数的个数 */
double totPjz = 0.0 ; /* 平均值 */

int ReadDat(void) ;
void WriteDat(void) ;

void CalValue(void)
{




}

void main()
{
 clrscr() ;
 if(ReadDat()) {
 printf("数据文件IN.DAT不能打开!\007\n") ;
 return ;
 }
 CalValue() ;
 printf("文件IN.DAT中共有正整数=%d个\n", totNum) ;
 printf("符合条件的正整数的个数=%d个\n", totCnt) ;
 printf("平均值=%.2lf\n", totPjz) ;
 WriteDat() ;
}

int ReadDat(void)
{
 FILE *fp ;
 int i = 0 ;

 if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
 while(!feof(fp)) {
 fscanf(fp, "%d,", &xx[i++]) ;
 }
 fclose(fp) ;
 return 0 ;
}

void WriteDat(void)
{
 FILE *fp ;

 fp = fopen("OUT9.DAT", "w") ;
 fprintf(fp, "%d\n%d\n%.2lf\n", totNum, totCnt, totPjz) ;
 fclose(fp) ;
}
===============================================================================
所需数据 :
===============================================================================
@2 IN.DAT 016
6045,6192,1885,3580,8544,6826,5493,8415,3132,5841,
6561,3173,9157,2895,2851,6082,5510,9610,5398,5273,
3438,1800,6364,6892,9591,3120,8813,2106,5505,1085,
5835,7295,6131,9405,6756,2413,6274,9262,5728,2650,
6266,5285,7703,1353,1510,2350,4325,4392,7573,8204,
7358,6365,3135,9903,3055,3219,3955,7313,6206,1631,
5869,5893,4569,1251,2542,5740,2073,9805,1189,7550,
4362,6214,5680,8753,8443,3636,4495,9643,3782,5556,
1018,9729,8588,2797,4321,4714,9658,8997,2080,5912,
9968,5558,9311,7047,6138,7618,5448,1466,7075,2166,
4025,3572,9605,1291,6027,2358,1911,2747,7068,1716,
9661,5849,3210,2554,8604,8010,7947,3685,2945,4224,
7014,9058,6259,9503,1615,1060,7787,8983,3822,2471,
5146,7066,1029,1777,7788,2941,3538,2912,3096,7421,
9175,6099,2930,4685,8465,8633,2628,7155,4307,9535,
4274,2857,6829,6226,8268,9377,9415,9059,4872,6072,
#E
@3 $OUT9.DAT 003
|160\|78\|5182.50
#E

第十套

===============================================================================
试题说明 :
===============================================================================
 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整
数, 函数ReadDat( )是读取这若干个正整数并存入数组xx中。请
编制函数CalValue( ), 其功能要求: 1. 求出这文件中共有多少
个正整数totNum; 2. 求这些数中的千位数位置上的数字与十位
数位置上的数字均为的奇数的个数totCnt, 以及满足此条件的这
些数的算术平均值totPjz, 最后调用函数WriteDat()把所求的结
果输出到文件OUT10.DAT中。
 注意: 部分源程序存放在PROG1.C中。
 请勿改动主函数main( )、读数据函数ReadDat()和输出数据
函数WriteDat()的内容。
===============================================================================
程序 :
===============================================================================
#include
#include
#define MAXNUM 200

int xx[MAXNUM] ;
int totNum = 0 ; /* 文件IN.DAT中共有多少个正整数 */
int totCnt = 0 ; /* 符合条件的正整数的个数 */
double totPjz = 0.0 ; /* 平均值 */

int ReadDat(void) ;
void WriteDat(void) ;

void CalValue(void)
{



}

void main()
{
 clrscr() ;
 if(ReadDat()) {
 printf("数据文件IN.DAT不能打开!\007\n") ;
 return ;
 }
 CalValue() ;
 printf("文件IN.DAT中共有正整数=%d个\n", totNum) ;
 printf("符合条件的正整数的个数=%d个\n", totCnt) ;
 printf("平均值=%.2lf\n", totPjz) ;
 WriteDat() ;
}

int ReadDat(void)
{
 FILE *fp ;
 int i = 0 ;

 if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
 while(!feof(fp)) {
 fscanf(fp, "%d,", &xx[i++]) ;
 }
 fclose(fp) ;
 return 0 ;
}

void WriteDat(void)
{
 FILE *fp ;

 fp = fopen("OUT10.DAT", "w") ;
 fprintf(fp, "%d\n%d\n%.2lf\n", totNum, totCnt, totPjz) ;
 fclose(fp) ;
}
===============================================================================
所需数据 :
===============================================================================
@2 IN.DAT 016
6045,6192,1885,3580,8544,6826,5493,8415,3132,5841,
6561,3173,9157,2895,2851,6082,5510,9610,5398,5273,
3438,1800,6364,6892,9591,3120,8813,2106,5505,1085,
5835,7295,6131,9405,6756,2413,6274,9262,5728,2650,
6266,5285,7703,1353,1510,2350,4325,4392,7573,8204,
7358,6365,3135,9903,3055,3219,3955,7313,6206,1631,
5869,5893,4569,1251,2542,5740,2073,9805,1189,7550,
4362,6214,5680,8753,8443,3636,4495,9643,3782,5556,
1018,9729,8588,2797,4321,4714,9658,8997,2080,5912,
9968,5558,9311,7047,6138,7618,5448,1466,7075,2166,
4025,3572,9605,1291,6027,2358,1911,2747,7068,1716,
9661,5849,3210,2554,8604,8010,7947,3685,2945,4224,
7014,9058,6259,9503,1615,1060,7787,8983,3822,2471,
5146,7066,1029,1777,7788,2941,3538,2912,3096,7421,
9175,6099,2930,4685,8465,8633,2628,7155,4307,9535,
4274,2857,6829,6226,8268,9377,9415,9059,4872,6072,
#E
@3 $OUT10.DAT 003
|160\|51\|5383.47
#E



上一篇:2000年全国计算机等级考试四级试卷 人气:8940
下一篇:1999年全国计算机等级考试四级试卷 人气:8854
点击此处浏览全部全国等级考试的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-5-15 bBlog v0.7.6
2008-5-15 team论坛 v2.0.3 SQL
2008-5-15 team论坛 v2.0.3 ACC
2008-5-15 速博交友网站管理系统 2007 SQL专
2008-5-15 目录直读式图片展示系统 v2.0
2008-5-15 迅思科量具计量管理软件 MTMS v1
2008-5-15 图看网IP地址查询系统 v1.0
2008-5-15 幸福公寓同居交友 简洁版
2008-5-15 九天备案中系统
2008-5-7 Windows XP SP3 官方英文版
2008-5-7 Windows XP SP3 官方香港中文版
2008-5-7 Windows XP SP3 官方繁体中文版
2008-5-7 Windows XP SP3 官方简体中文版
2008-4-30 Multiple Unzip Wizard 1.02
2008-4-30 Multiple Unrar Wizard 1.0.0
2008-4-30 WinZip Install/Try/Uninstall a
2008-4-30 ZIP压缩文件修复器WzipFix 2.0
2008-4-30 Pentazip 6.01 Build 189 For Wi
  发表评论
姓 名: 验证码: [ 全部贴吧 ] [ 浏览评论 ]
内 容:
[ 汉字翻译拼音 ] [ 广告代码 ] [ 符号对照表 ] [ 进制转换 ] [ 经典小工具 ] [ 个税计算 ] [ 汉字简繁转换 ] [ 普通单位换算 ] [ 公制单位换算 ]
[ 生辰老黄历 ] [ 国内电话区号 ] [ 国家代码与域名缩写 ] [ 文字加密解密 ] [ 健康查询 ] [ 万年历 ] [ 手机号码查询 ] [ ip搜索 ] [ Google PR查询 ]
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報