资源描述:
《计算机二级c语言题库之程序编写(programming of computer two level c language question bank)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、计算机二级c语言题库之程序编写(ProgrammingofcomputertwolevelClanguagequestionbank)Three.WriteprogramsInthepositiveinteger,find1minimumnumbersof3,5,7,and9inadditiontotheremainderof1,3,5,7,andwritetheformat"%d"tothenewfileDesign1.datunderthePapersubfolderofthecandidatefolder.#include#in
2、cludeVoid,main(){Addthecodehere*//*candidatesFILE*p;inti;P=fopen("Design1.dat","W");For(i=1;;i++)If(i%3==1&&i%5==3&&i%7==5&&i%9==7break);Fprintf(P,%d,I);Fclose(P);}IfaandBare1pairsofcloseness,thenthefactorofaisequaltothefactorofBandBandisequaltoa,andaisnotequaltoB.Forexa
3、mple:220and284are1pairsofintimacy,284,220,and1pairsofintimacy.Findallthenumberofpairsin6~5000,andwritethenumberofeachpairwiththestatement"fprintf"(P,"%6d","%6d","a","B")tothenewfileDesign2.datunderthePapersubfolderofthecandidatefolder.#includeVoid,main(){FILE,*p;int,a
4、,B,C,k;P=fopen("design.dat","W");Addthecodehere*//*candidatesFor(k=6;k<=5000;k++){b=0;c=0;For(a=1;a5、eightvalueistheproductofthepositionvalueofthecharacterinthestringandthevalueoftheASCIIcodeofthecharacter.Thepositionvaluestartsat1andincrementsaccordingly.Writesthevalueofeachcharactertothenewfiledesign.datinthePapersubdirectoryofthesourcedirectoryintheform"%d".#include
6、#includeVoid,main(){FILE,*p;int,I,w;Char*s="we45*&y3r#$1"";Addthecodehere*//*candidatesP=fopen("design.dat","W");For(i=0;s[i];=' ';i++){w=(i+1)*s[i];Fprintf(P,%d,w);}Fclose(P);}Divideeachrowofthearrayabytheabsolutemaximumvalueoftheelementontheline,andthenwritetheaarrayt
7、othenewfileDesign1.datunderthePapersubfolderofthecandidatefolder.#include#includeVoid,main(){float,a[3][3]={{1.3,2.7,3.6},{2,3,4.7},{3,4,1.27}};FILE*p;floatX;inti;j;Addthecodehere*//*candidatesFor(i=0;i<3;i++){x=a[i][0];For(j=1;j<3;j++)If(a[i][j]>x)x=a[i][j];For
8、(j=0;j<3;j++)a[i][j]/=x;}Theendof***//addcodeP=