第三次作业 结对编程
Posted 天卿雪舞
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第三次作业 结对编程相关的知识,希望对你有一定的参考价值。
结对编程1 四则运算
201421122075 郭晓迪
201421122089 曾瑞
需求分析:
思维导图
代码展示
中英文对比
char * edaanpanduan(char daan[],char * shuru,char * timu)
{
static char panduanjieguo[30];
FILE * in ,* out,* cuoti;
in=fopen("leijitimushu.txt","r");
fscanf(in,"%d,%d",&eright,&ewrong);
fclose(in);
if(strcmp(shuru,edaan)==0)
{
strcpy(panduanjieguo,"Right!");
eright++;
}
else
{
strcpy(panduanjieguo,"wrong!");
strcat(panduanjieguo,"Answer is:");
strcat(panduanjieguo,edaan);
ewrong++;
cuoti=fopen("cuotiji.txt","a");
fprintf(cuoti,"%s=%s wrong!Right answer is %s\\n",timu,shuru,edaan);
fclose(cuoti);
}
out=fopen("leijitimushu.txt","w");
fprintf(out,"%d,%d",eright,ewrong);
fclose(out);
return panduanjieguo;
}
{
static char panduanjieguo[30];
FILE * in ,* out,* cuoti;
in=fopen("leijitimushu.txt","r");
fscanf(in,"%d,%d",&eright,&ewrong);
fclose(in);
if(strcmp(shuru,edaan)==0)
{
strcpy(panduanjieguo,"Right!");
eright++;
}
else
{
strcpy(panduanjieguo,"wrong!");
strcat(panduanjieguo,"Answer is:");
strcat(panduanjieguo,edaan);
ewrong++;
cuoti=fopen("cuotiji.txt","a");
fprintf(cuoti,"%s=%s wrong!Right answer is %s\\n",timu,shuru,edaan);
fclose(cuoti);
}
out=fopen("leijitimushu.txt","w");
fprintf(out,"%d,%d",eright,ewrong);
fclose(out);
return panduanjieguo;
}
char * daanpanduan(char daan[],char * shuru,char *timu)
{
static char panduanjieguo[20];
FILE * in ,* out,* cuoti;
in=fopen("leijitimushu.txt","r");
fscanf(in,"%d,%d",&right,&wrong);
fclose(in);
if(strcmp(shuru,daan)==0)
{
strcpy(panduanjieguo,"回答正确!!!!");
right++;
}
else
{
strcpy(panduanjieguo,"错误!");
strcat(panduanjieguo,"正确答案为:");
strcat(panduanjieguo,daan);
wrong++;
cuoti=fopen("cuotiji.txt","a");
fprintf(cuoti,"%s=%s 错误!正确答案为%s\\n",timu,shuru,daan);
fclose(cuoti);
}
out=fopen("leijitimushu.txt","w");
fprintf(out,"%d,%d",right,wrong);
fclose(out);
return panduanjieguo;
}
程序运行
小结感受
结对编程需要好好进行分工,从而才能好好团结协作,以1+1>2的效率完成工作。
评价伙伴
略。
PSP.
以上是关于第三次作业 结对编程的主要内容,如果未能解决你的问题,请参考以下文章