资源描述:
《二级c上机编程答案※※a※b……题型(two level c programming on the answer of a a b...... questions)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、二级c上机编程答案※※a※b……题型(TwolevelCprogrammingontheanswerofaaB......Questions)4.specifiesthattheinputstringcontainsonlylettersand*numbers.Writethefunctionfun,whosefunctionistodeleteallthe*numbersinastring.Whenwritingfunctions,stringfunctionsprovidedbytheClanguagemustnotbeused.Forexample,theco
2、ntentsofthestringare:****A*BC*DEF*G*******,andthecontentsofthestringafterdeletionshouldbe:ABCDEFG.Note:partofthesourceisinthefilePROG1.C.Donotchangeanyofthemainfunctions,main,andanyotherfunctions.Justfillinthefewparenthesesyouhavewritteninthecurlybracesofthefunctionfun.[referenceanswer
3、]Voidfun(char*a){Int,I,j=0;For(I=0;a[i]!=' ';I)If(a[i]!='*'A[j]=a[i];/*ifnottodeletethecharacter'*'left.A[j]=' ';/*addthefinalendofstring' '.}12.specifiesthattheinputstringcontainsonlylettersand*numbers.Pleasewritefunctionfun,itsfunctionis:inadditiontotheleadingstring*number,thestri
4、ngwillbedeletedallother*.Whenwritingfunctions,stringfunctionsprovidedbytheClanguagemustnotbeused.Forexample,thecontentsinthestringare:****A*BC*DEF*G*******,andthecontentsofthestringshouldbe:****ABCDEFGafterdeletion.Note:partofthesourceisinthefilePROG1.C.Donotchangeanyofthemainfunctions
5、,main,andanyotherfunctions.Justfillinthefewparenthesesyouhavewritteninthecurlybracesofthefunctionfun.[referenceanswer]Voidfun(char*a){Inti=0;Char*p=a;While(*p&&*p==``*'){A[i]=*p;I;P;}While(*p){If(*p!='*'{A[i]=*p;I;}P;}A[i]=` ';}14.specifiesthattheinputstringcontainsonlylettersand*numb
6、ers.Pleasewritethefunctionfun,itsfunctionis:thestringtail*numberalldelete,frontandmiddleofthe*numberisnotmoving.Forexample,thecontentsinthestringare:****A*BC*DEF*G*******,andthecontentsofthestringshouldbe:****A*BC*DEF*Gafterdeletion.Whenwritingfunctions,stringfunctionsprovidedbytheClan
7、guagemustnotbeused.Note:partofthesourceisinthefilePROG1.C.Donotchangeanyofthemainfunctions,main,andanyotherfunctions.Justfillinthefewparenthesesyouhavewritteninthecurlybracesofthefunctionfun.[referenceanswer]Voidfun(char*a){While(*a!=' 'A;A;/*aisapointertotheendofthestring.While(*a=