云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 大一计算机上机题目及答案(西电专用)

大一计算机上机题目及答案(西电专用)

  • 62 次阅读
  • 3 次下载
  • 2025/6/15 11:46:50

#include #include #include typedef struct{

char name[20]; double x,y,z;

} IN; int main(){

int i=0,k=0,j=0,n,m;

IN stu1[1024],stu2[1024],stu3[1024]; FILE *np,*fp,*ip;

if((np=fopen(\ printf(\}

if((fp=fopen(\ printf(\}

if((ip=fopen(\ printf(\}

while(!feof(np)){

fscanf(np,\

}

++i;

while(!feof(fp)){ }

for(n=0;n

for(m=0;m

if(strcmp(stu1[n].name,stu2[m].name)==0){ strcpy(stu3[j].name,stu1[n].name); fscanf(fp,\++k;

stu3[j].x=stu1[n].x; stu3[j].y=stu2[m].y; } } ++j;

for(i=0;i

fprintf(ip,\

+stu3[i].y)/2);

}

fclose(fp);fclose(np);fclose(ip); return 0;

输入输出: File1.txt:

File2.txt:

File3.txt:

字符串类:

题目一:

算法描述:首先将读入的每一个单词存入一个数组里面,然

后对数组进行操作即可。

源代码: #include

#include #include #include enum{IN=1,OUT=0}; typedef struct { char word[100]; int count; }KEY;

void sum(KEY p[],int m){ int i,n;

for(i=0;i

for(n=i+1;n

if(strcmp(p[i].word,p[n].word)==0){

++(p[i].count);

p[n].word[0]='\\0'; }

printf(\单词数量统计\\n\ for(i=0;i

if(p[i].word[0]!='\\0')printf(\

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

#include #include #include typedef struct{ char name[20]; double x,y,z; } IN; int main(){ int i=0,k=0,j=0,n,m; IN stu1[1024],stu2[1024],stu3[1024]; FILE *np,*fp,*ip; if((np=fopen(\ printf(\} if((fp=fopen(\ printf(\} if((ip=fopen(\ printf(\} while(!feof(np)){

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com