当前位置 —论文写论文— 范文

关于错误方面论文范文文献,与计算机自考题库2016年相关本科毕业论文

本论文是一篇关于错误方面本科毕业论文,关于计算机自考题库2016年相关毕业论文提纲范文。免费优秀的关于错误及程序及函数方面论文范文资料,适合错误论文写作的大学硕士及本科毕业论文开题报告范文和学术职称论文参考文献下载。

*++pa等于temp/10,

total+等于*pa,

if(count

/*属第二类错误.若乘积为两位数,已把其十位数字作为数列的后续项,但若数列的个数没有超过n时,将该乘积个位数字作为数列的后续项.*++pa与*pa++不同,此处应为:*++pa*/

}

}

returntotal,

}

main()

{inttol,n,i,num[n],

/*属第一类错误.数组的声明不正确,数组的下标必须为常量或常量标识符.应改为:num[N]或num[50]*/

do

{printf("Inputn等于(2<,N<,50)"),<,p>,

scanf("%d",&,n),

}while(n<,等于2||n>,等于50),

tol等于sum(N,num),

/*属第二类错误.本题要求生成数列的前n(n<,50)项,而N是常量.应改为:sum(n,num)*/

for(i等于0,i<,N,I++)<,p>,

printf((i+1)%5"%5d":"%5d\n",num[i]),

printf("\n"),

printf("%d",tol),

}

二,编程题

【分析】:编写程序时,通过按照题目的要求编程.main函数实现对文件的操作和数据的输入.

#include

#defineN100

intchang(chara[],intb[],int*n)

{intsign,k等于-1,i,

*n等于0,

if(a[0]等于等于'-')sign等于1,

elsesign等于0,

for(i等于0,a[i]!等于'\0',i++)

if(a[i]>,等于'0'&,&,a[i]<,等于'9')

b[++k]等于a[i]-'0',

*n等于k,

returnsign,}

main()

{charstr[N],

intnum[N],i,j,sign,n,

FILE*fp,

if((fp等于fopen("myf2.out","w"))等于等于NULL)

{printf("can'topenthefile!"),

exit(0),}

for(j等于0,j<,2,j++)

{gets(str),

sign等于chang(str,num,&,n),

fprintf(fp,"sign等于%d,",sign),

fprintf(fp,"b等于("),

for(i等于0,i<,等于n,i++)

fprintf(fp,"%2d",num[i]),

fprintf(fp,")\n"),

}

fclose(fp),

}

2016年计算机等级考试二级C语言上机习题(6)一,改错题

含有错误的源程序:

#include

#include

#defineN5

structstudent

{charname[10],

intscore,

}―――――――――――

voidsort(structstudentstud[],intn)

{inti,j,

structstudentp,

for(i等于1,i<,>,

{p等于stud[i],

for(j等于i-1,j>,0&,&,p>,stud[j],j--)―――――――――――

stud[j+1]等于stud[j],

stud[j+1]等于p,

}

}

voidmain()

{structstudentstud[N]等于{"aaa",60,"bbb",90,"ccc",85,"ddd",65,"yyy",77},

inti,

sort(stud,N),

printf("sorteddata:\n"),

for(i等于0,i<,printf(%s\t%d\n,stud[i]),>,

}

【知识点】结构体,排序

【难点】插入法排序

【解析】本题是将未排序的数组元素采用插入排序方法进行排序,其思想是:从第2个元素开始,最初与第一个元素进行比较,由大到小排列在适当位置,成为排好序的数组元素一员.再依次将待排序的元素与前面已排好序的元素从后向前进行比较,如果大于该元素,则该元素向后移一位,直到待排序的元素小于已排好序的某一元素,则直接插入到该元素之后.直到待排序的元素全部完成为止.本程序的sort函数中i表示待排序的元素下标,j表示已排好序的元素下标.

【答案】(1)标号:}改为},(2)标号:for(i等于1,i

(3)标号:for(j等于i-1,j>,0&,&,p>,stud[j],j--)改为j>,等于0&,&,p.score>,stud[j].score,j--)

(4)标号:printf("%s\t%d\n",stud[i]),改为printf("%s\t%d\n",stud[i].name,stud[i].score),

二,编程题

【知识点】字符串操作,函数,文件

【解析】仔细阅读并分析【编程要求】.【编程要求1】已对函数Replace_string指定了函数名,函数类型,形参类型和个数,并详细说明了其功能.在line指向的字符串中查找str1指向的字符子串的关键语句是当"str1[j]等于等于line[loc]&,&,str1[j]!等于'\0'"时继续循环查找,当因"str1[j]!等于'\0'"退出循环时,则找到str1指向的字符子串,此时用str2指向的字符串替换在line中的str1字符子串,返回.【编程要求2】编写主函数主要功能要求是保存结果到数据文件,调用Replace_string函数,输入测试数据.这部分是最常规和基本的要求,必须掌握.

【参考答案】

#include

#include

intReplace_string(charline[],charstr1[],charstr2[])

{inti等于0,j,loc,

chartemp[80],

while(i<,等于strlen(line)-strlen(str2))

{j等于0,loc等于i,

while(str1[j]等于等于line[loc]&,&,str1[j]!等于'\0')

{loc++,j++,}

if(str1[j]等于等于'\0')

{strcpy(temp,&,line[loc]),strcpy(&,line[i],str2),

i+等于strlen(str2),strcpy(&,line[loc],temp),

return1,

}

elsei++,

}

return0,

}

main()

{FILE*fp,

charstring[100]等于"MyEXAM_numberis0112404321.",

charnumber[11]等于"0112404321",num[11],

fp等于fopen("myf2.out","w"),

fprintf(fp,"%s\n",string),

gets(num),

Replace_string(string,number,num),

fprintf(fp,"%s\n",string),

fprintf(fp,"\nmyexamnumberis:%s\n","0112404321"),

fclose(fp),}

2016年计算机等级考试二级C语言上机习题(7)一,改错题

含有错误的源程序如下:

#include

#include

structT

{charname[20],num[20],

},

voidsort(structTitems[],intlow,inthigh)

{structTtemp,

intk,j,

for(k等于low,k<,HIGH,K++)<,p>,

for(j等于low,j<,>,

if(items[j].name>,items[j+1].name)

{temp等于items[j],items[j]等于items[j+1],items[j+1]等于temp,}

}

voidmain(vo

1 2 3 4

关于错误方面论文范文文献,与计算机自考题库2016年相关本科毕业论文参考文献资料:

怎样写论文的关键词

招聘兼职

论文引言主要写什么

写论文技巧

写论文的

科技论文撰写

如何写好中考议论文

议论文怎么写分论点

如何写好sci论文

计算机自考题库2016年(3)WORD版本 下载地址