大家好,今天来为大家解答t3在字符表中找不到字符串这个问题的一些问题点,包括t3在字符表中找不到字符串怎么办也一样很多人还不知道,因此呢,今天就来为大家分析分析,现在让我们一起来看看吧!如果解决了您的问题,还望您关注下本站哦,谢谢~
本文目录
tuple元组怎么替换字符应聘,电气类 自动化类 笔试题目C语言程序设计——课程设计——通讯录管理系统用友t3运行时错误字符串后的引号不完整C语言课程设计tuple元组怎么替换字符In?[135]:?a?=?range(5)
In?[136]:?a
Out[136]:?[0,?1,?2,?3,?4]以上a为创建的列表。
将列表a转化为tuple?b:
In?[137]:?b?=?tuple(a)
In?[138]:?b
Out[138]:?(0,?1,?2,?3,?4)将列表a转化为字符列表:
In?[139]:?map(str,a)
Out[139]:?['0',?'1',?'2',?'3',?'4']将列表a转化为字符串:
In?[149]:?''.join(map(str,a))
Out[149]:?'01234'
将tuple?b转化为list:
In?[150]:?list(b)
Out[150]:?[0,?1,?2,?3,?4]将tuple?b转化为字符列表:
In?[153]:?c=map(str,b)
In?[154]:?c
Out[154]:?['0',?'1',?'2',?'3',?'4']将tuple?b转化为字符串:
In?[155]:?''.join(map(str,b))
Out[155]:?'01234'
将字符列表c转化为数值列表:
In?[157]:?map(int,?c)
Out[157]:?[0,?1,?2,?3,?4]将字符列表c转化为tuple:
In?[163]:?tuple(c)
Out[163]:?('0',?'1',?'2',?'3',?'4')
将字符串分割为字符列表时,需要指定分隔符,默认为空格与制表符。例如:
In?[164]:?st?=?'t1=1;t2=2;t3=3'
In?[166]:?st.split(';')
Out[166]:?['t1=1',?'t2=2',?'t3=3']分隔符长度可以不止一个字符。
应聘,电气类 自动化类 笔试题目銆€銆€鏁板瓧鐢佃矾
銆€銆€1銆佸悓姝ョ數璺拰寮傛鐢佃矾鐨勫尯鍒槸浠€涔堬紵锛堜粫鍏板井鐢靛瓙锛?br/>銆€銆€2銆佷粈涔堟槸鍚屾閫昏緫鍜屽紓姝ラ€昏緫锛燂紙姹夌帇绗旇瘯锛?br/>銆€銆€鍚屾閫昏緫鏄椂閽熶箣闂存湁鍥哄畾鐨勫洜鏋滃叧绯汇€傚紓姝ラ€昏緫鏄悇鏃堕挓涔嬮棿娌℃湁鍥哄畾鐨勫洜鏋滃叧绯汇€?br/>銆€銆€3銆佷粈涔堟槸"绾夸笌"閫昏緫锛岃瀹炵幇瀹冿紝鍦ㄧ‖浠剁壒鎬т笂鏈変粈涔堝叿浣撹姹傦紵锛堟眽鐜嬬瑪璇曪級
銆€銆€绾夸笌閫昏緫鏄袱涓緭鍑轰俊鍙风浉杩炲彲浠ュ疄鐜颁笌鐨勫姛鑳姐€傚湪纭欢涓婏紝瑕佺敤oc闂ㄦ潵瀹炵幇锛岀敱浜庝笉鐢?oc闂ㄥ彲鑳戒娇鐏岀數娴佽繃澶э紝鑰岀儳鍧忛€昏緫闂ㄣ€?鍚屾椂鍦ㄨ緭鍑虹鍙e簲鍔犱竴涓笂鎷夌數闃汇€?br/>銆€銆€4銆佷粈涔堟槸Setup鍜孒oldup鏃堕棿锛燂紙姹夌帇绗旇瘯锛?br/>銆€銆€5銆乻etup鍜宧oldup鏃堕棿,鍖哄埆.锛堝崡灞变箣妗ワ級
銆€銆€6銆佽В閲妔etuptime鍜宧oldtime鐨勫畾涔夊拰鍦ㄦ椂閽熶俊鍙峰欢杩熸椂鐨勫彉鍖栥€傦紙鏈煡锛?br/>銆€銆€7銆佽В閲妔etup鍜宧oldtimeviolation锛岀敾鍥捐鏄庯紝骞惰鏄庤В鍐冲姙娉曘€傦紙濞佺洓VIA
銆€銆€2003.11.06涓婃捣绗旇瘯璇曢锛?br/>銆€銆€Setup/holdtime鏄祴璇曡姱鐗囧杈撳叆淇″彿鍜屾椂閽熶俊鍙蜂箣闂寸殑鏃堕棿瑕佹眰銆傚缓绔嬫椂闂存槸鎸囪Е鍙?鍣ㄧ殑鏃堕挓淇″彿涓婂崌娌垮埌鏉ヤ互鍓嶏紝鏁版嵁绋冲畾涓嶅彉鐨勬椂闂淬€傝緭鍏ヤ俊鍙峰簲鎻愬墠鏃堕挓涓婂崌娌匡紙濡備笂鍗囨部鏈夋晥锛塗鏃堕棿鍒拌揪鑺墖锛岃繖涓猅灏辨槸寤虹珛鏃堕棿-Setuptime.濡備笉婊¤冻setuptime,杩欎釜鏁版嵁灏变笉鑳借杩欎竴鏃堕挓鎵撳叆瑙﹀彂鍣紝鍙湁鍦ㄤ笅涓€涓椂閽熶笂鍗囨部锛屾暟鎹墠鑳借鎵撳叆瑙﹀彂鍣ㄣ€?淇濇寔鏃堕棿鏄寚瑙﹀彂鍣ㄧ殑鏃堕挓淇″彿涓婂崌娌垮埌鏉ヤ互鍚庯紝鏁版嵁绋冲畾涓嶅彉鐨勬椂闂淬€傚鏋渉oldtime涓嶅锛屾暟鎹悓鏍蜂笉鑳借鎵撳叆瑙﹀彂鍣ㄣ€?br/>銆€銆€寤虹珛鏃堕棿(SetupTime)鍜屼繚鎸佹椂闂达紙Holdtime锛夈€傚缓绔嬫椂闂存槸鎸囧湪鏃堕挓杈规部鍓嶏紝鏁版嵁淇?鍙烽渶瑕佷繚鎸佷笉鍙樼殑鏃堕棿銆備繚鎸佹椂闂存槸鎸囨椂閽熻烦鍙樿竟娌垮悗鏁版嵁淇″彿闇€瑕佷繚鎸佷笉鍙樼殑鏃堕棿銆傚鏋滀笉婊¤冻寤虹珛鍜屼繚鎸佹椂闂寸殑璇濓紝閭d箞DFF灏嗕笉鑳芥纭湴閲囨牱鍒版暟鎹紝灏嗕細鍑虹幇metastability鐨勬儏鍐点€傚鏋滄暟鎹俊鍙峰湪鏃堕挓娌胯Е鍙戝墠鍚庢寔缁殑鏃堕棿鍧囪秴杩囧缓绔嬪拰淇濇寔鏃?闂达紝閭d箞瓒呰繃閲忓氨鍒嗗埆琚О涓哄缓绔嬫椂闂磋閲忓拰淇濇寔鏃堕棿瑁曢噺銆?br/>銆€銆€8銆佽璇村鏁板瓧閫昏緫涓殑绔炰簤鍜屽啋闄╃殑鐞嗚В锛屽苟涓句緥璇存槑绔炰簤鍜屽啋闄╂€庢牱娑堥櫎銆傦紙浠曞叞寰?鐢靛瓙锛?br/>銆€銆€9銆佷粈涔堟槸绔炰簤涓庡啋闄╃幇璞★紵鎬庢牱鍒ゆ柇锛熷浣曟秷闄わ紵锛堟眽鐜嬬瑪璇曪級
銆€銆€鍦ㄧ粍鍚堥€昏緫涓紝鐢变簬闂ㄧ殑杈撳叆淇″彿閫氳矾涓粡杩囦簡涓嶅悓鐨勫欢鏃讹紝瀵艰嚧鍒拌揪璇ラ棬鐨勬椂闂翠笉涓€鑷村彨绔炰簤銆備骇鐢熸瘺鍒哄彨鍐掗櫓銆傚鏋滃竷灏斿紡涓湁鐩稿弽鐨勪俊鍙峰垯鍙兘浜х敓绔炰簤鍜屽啋闄╃幇璞°€傝В鍐虫柟娉曪細涓€鏄坊鍔犲竷灏斿紡鐨勬秷鍘婚」锛屼簩鏄湪鑺墖澶栭儴鍔犵數瀹广€?br/>銆€銆€10銆佷綘鐭ラ亾閭d簺甯哥敤閫昏緫鐢靛钩锛烼TL涓嶤OMS鐢靛钩鍙互鐩存帴浜掕繛鍚楋紵锛堟眽鐜嬬瑪璇曪級
銆€銆€甯哥敤閫昏緫鐢靛钩锛?2V锛?V锛?.3V锛汿TL鍜孋MOS涓嶅彲浠ョ洿鎺ヤ簰杩烇紝鐢变簬TTL鏄湪0.3-3.6V涔嬮棿锛岃€孋MOS鍒欐槸鏈夊湪12V鐨勬湁鍦?V鐨勩€侰MOS杈撳嚭鎺ュ埌TTL鏄彲浠ョ洿鎺ヤ簰杩炪€俆TL鎺ュ埌CMOS闇€瑕佸湪杈撳嚭绔彛鍔犱竴涓婃媺鐢甸樆鎺ュ埌5V鎴栬€?2V銆?br/>銆€銆€11銆佸浣曡В鍐充簹绋虫€併€傦紙椋炲埄娴︼紞澶у攼绗旇瘯锛?br/>銆€銆€浜氱ǔ鎬佹槸鎸囪Е鍙戝櫒鏃犳硶鍦ㄦ煇涓瀹氭椂闂存鍐呰揪鍒颁竴涓彲纭鐨勭姸鎬併€傚綋涓€涓Е鍙戝櫒杩涘叆浜?br/>銆€銆€绋虫€佹椂锛屾棦鏃犳硶棰勬祴璇ュ崟鍏冪殑杈撳嚭鐢靛钩锛屼篃鏃犳硶棰勬祴浣曟椂杈撳嚭鎵嶈兘绋冲畾鍦ㄦ煇涓纭殑鐢靛钩
銆€銆€涓娿€傚湪杩欎釜绋冲畾鏈熼棿锛岃Е鍙戝櫒杈撳嚭涓€浜涗腑闂寸骇鐢靛钩锛屾垨鑰呭彲鑳藉浜庢尟鑽$姸鎬侊紝骞朵笖杩欑鏃?br/>銆€銆€鐢ㄧ殑杈撳嚭鐢靛钩鍙互娌夸俊鍙烽€氶亾涓婄殑鍚勪釜瑙﹀彂鍣ㄧ骇鑱斿紡浼犳挱涓嬪幓銆?br/>銆€銆€12銆両C璁捐涓悓姝ュ浣嶄笌寮傛澶嶄綅鐨勫尯鍒€傦紙鍗楀北涔嬫ˉ锛?br/>銆€銆€13銆丮OORE涓?MEELEY鐘舵€佹満鐨勭壒寰併€傦紙鍗楀北涔嬫ˉ锛?br/>銆€銆€14銆佸鏃跺煙璁捐涓?濡備綍澶勭悊淇″彿璺ㄦ椂鍩熴€傦紙鍗楀北涔嬫ˉ锛?br/>銆€銆€15銆佺粰浜唕eg鐨剆etup,hold鏃堕棿锛屾眰涓棿缁勫悎閫昏緫鐨刣elay鑼冨洿銆傦紙椋炲埄娴︼紞澶у攼绗旇瘯锛?br/>銆€銆€Delay<period-setup鈥?hold
銆€銆€16銆佹椂閽熷懆鏈熶负T,瑙﹀彂鍣―1鐨勫缓绔嬫椂闂存渶澶т负T1max锛屾渶灏忎负T1min銆傜粍鍚堥€昏緫鐢佃矾鏈€澶у欢
銆€銆€杩熶负T2max,鏈€灏忎负T2min銆傞棶锛岃Е鍙戝櫒D2鐨勫缓绔嬫椂闂碩3鍜屼繚鎸佹椂闂村簲婊¤冻浠€涔堟潯浠躲€傦紙鍗?br/>銆€銆€涓猴級
銆€銆€17銆佺粰鍑烘煇涓竴鑸椂搴忕數璺殑鍥撅紝鏈塗setup,Tdelay,Tck->q,杩樻湁clock鐨刣elay,鍐欏嚭鍐?br/>銆€銆€瀹氭渶澶ф椂閽熺殑鍥犵礌锛屽悓鏃剁粰鍑鸿〃杈惧紡銆傦紙濞佺洓VIA2003.11.06涓婃捣绗旇瘯璇曢锛?br/>銆€銆€18銆佽璇撮潤鎬併€佸姩鎬佹椂搴忔ā鎷熺殑浼樼己鐐广€傦紙濞佺洓VIA2003.11.06涓婃捣绗旇瘯璇曢锛?br/>銆€銆€19銆佷竴涓洓绾х殑Mux,鍏朵腑绗簩绾т俊鍙蜂负鍏抽敭淇″彿濡備綍鏀瑰杽timing銆傦紙濞佺洓VIA
銆€銆€2003.11.06涓婃捣绗旇瘯璇曢锛?br/>銆€銆€20銆佺粰鍑轰竴涓棬绾х殑鍥撅紝鍙堢粰浜嗗悇涓棬鐨勪紶杈撳欢鏃讹紝闂叧閿矾寰勬槸浠€涔堬紝杩橀棶缁欏嚭杈撳叆锛?br/>銆€銆€浣垮緱杈撳嚭渚濊禆浜庡叧閿矾寰勩€傦紙鏈煡锛?br/>銆€銆€21銆侀€昏緫鏂归潰鏁板瓧鐢佃矾鐨勫崱璇哄浘鍖栫畝锛屾椂搴忥紙鍚屾寮傛宸紓锛夛紝瑙﹀彂鍣ㄦ湁鍑犵锛堝尯鍒紝浼?br/>銆€銆€鐐癸級锛屽叏鍔犲櫒绛夌瓑銆傦紙鏈煡锛?br/>銆€銆€22銆佸崱璇哄浘鍐欏嚭閫昏緫琛ㄨ揪浣裤€傦紙濞佺洓VIA2003.11.06涓婃捣绗旇瘯璇曢锛?br/>銆€銆€23銆佸寲绠€F(A,B,C,D)=m(1,3,4,5,10,11,12,13,14,15)鐨勫拰銆傦紙濞佺洓锛?br/>銆€銆€24銆乸leaseshowtheCMOSinverterschmatic,layoutanditscrosssectionwithP-
銆€銆€wellprocess.Plotitstransfercurve(Vout-Vin)Andalsoexplainthe
銆€銆€operationregionofPMOSandNMOSforeachsegmentofthetransfercurve?锛堝▉
銆€銆€鐩涚瑪璇曢circuitdesign-beijing-03.11.09锛?br/>銆€銆€25銆乀odesignaCMOSinvertorwithbalanceriseandfalltime,pleasedefine
銆€銆€therationofchannelwidthofPMOSandNMOSandexplain?
銆€銆€26銆佷负浠€涔堜竴涓爣鍑嗙殑鍊掔浉鍣ㄤ腑P绠$殑瀹介暱姣旇姣擭绠$殑瀹介暱姣斿ぇ锛燂紙浠曞叞寰數瀛愶級
銆€銆€27銆佺敤mos绠℃惌鍑轰竴涓簩杈撳叆涓庨潪闂ㄣ€傦紙鎵櫤鐢靛瓙绗旇瘯锛?br/>銆€銆€28銆乸leasedrawthetransistorlevelschematicofacmos2inputANDgateand
銆€銆€explainwhichinputhasfasterresponseforoutputrisingedge.(lessdelay
銆€銆€time)銆傦紙濞佺洓绗旇瘯棰榗ircuitdesign-beijing-03.11.09锛?br/>銆€銆€29銆佺敾鍑篘OT,NAND,NOR鐨勭鍙凤紝鐪熷€艰〃锛岃繕鏈塼ransistorlevel鐨勭數璺€傦紙Infineon绗?br/>銆€銆€璇曪級
銆€銆€30銆佺敾鍑篊MOS鐨勫浘锛岀敾鍑簍ow-to-onemuxgate銆傦紙濞佺洓VIA2003.11.06涓婃捣绗旇瘯璇曢锛?br/>銆€銆€31銆佺敤涓€涓簩閫変竴mux鍜屼竴涓猧nv瀹炵幇寮傛垨銆傦紙椋炲埄娴︼紞澶у攼绗旇瘯锛?br/>銆€銆€32銆佺敾鍑篩=A*B+C鐨刢mos鐢佃矾鍥俱€傦紙绉戝箍璇曢锛?br/>銆€銆€33銆佺敤閫昏緫浠拰cmos鐢佃矾瀹炵幇ab+cd銆傦紙椋炲埄娴︼紞澶у攼绗旇瘯锛?br/>銆€銆€34銆佺敾鍑篊MOS鐢佃矾鐨勬櫠浣撶绾х數璺浘锛屽疄鐜癥=A*B+C(D+E)銆傦紙浠曞叞寰數瀛愶級
銆€銆€35銆佸埄鐢?閫?瀹炵幇F(x,y,z)=xz+yz鈥欍€傦紙鏈煡锛?br/>銆€銆€36銆佺粰涓€涓〃杈惧紡f=xxxx+xxxx+xxxxx+xxxx鐢ㄦ渶灏戞暟閲忕殑涓庨潪闂ㄥ疄鐜帮紙瀹為檯涓婂氨鏄寲
銆€銆€绠€锛夈€?br/>銆€銆€37銆佺粰鍑轰竴涓畝鍗曠殑鐢卞涓狽OT,NAND,NOR缁勬垚鐨勫師鐞嗗浘锛屾牴鎹緭鍏ユ尝褰㈢敾鍑哄悇鐐规尝褰€?br/>銆€銆€锛圛nfineon绗旇瘯锛?br/>銆€銆€38銆佷负浜嗗疄鐜伴€昏緫锛圓XORB锛塐R锛圕ANDD锛夛紝璇烽€夌敤浠ヤ笅閫昏緫涓殑涓€绉嶏紝骞惰鏄庝负浠€
銆€銆€涔堬紵1锛塈NV2锛堿ND3锛塐R4锛塏AND5锛塏OR6锛塜OR绛旀锛歂AND锛堟湭鐭ワ級
銆€銆€39銆佺敤涓庨潪闂ㄧ瓑璁捐鍏ㄥ姞娉曞櫒銆傦紙鍗庝负锛?br/>銆€銆€40銆佺粰鍑轰袱涓棬鐢佃矾璁╀綘鍒嗘瀽寮傚悓銆傦紙鍗庝负锛?br/>銆€銆€41銆佺敤绠€鍗曠數璺疄鐜帮紝褰揂涓鸿緭鍏ユ椂锛岃緭鍑築娉㈠舰涓衡€︼紙浠曞叞寰數瀛愶級
銆€銆€42銆丄,B,C,D,E杩涜鎶曠エ锛屽鏁版湇浠庡皯鏁帮紝杈撳嚭鏄疐锛堜篃灏辨槸濡傛灉A,B,C,D,E涓?鐨勪釜鏁版瘮0
銆€銆€澶氾紝閭d箞F杈撳嚭涓?锛屽惁鍒橣涓?锛夛紝鐢ㄤ笌闈為棬瀹炵幇锛岃緭鍏ユ暟鐩病鏈夐檺鍒躲€傦紙鏈煡锛?br/>銆€銆€43銆佺敤娉㈠舰琛ㄧずD瑙﹀彂鍣ㄧ殑鍔熻兘銆傦紙鎵櫤鐢靛瓙绗旇瘯锛?br/>銆€銆€44銆佺敤浼犺緭闂ㄥ拰鍊掑悜鍣ㄦ惌涓€涓竟娌胯Е鍙戝櫒銆傦紙鎵櫤鐢靛瓙绗旇瘯锛?br/>銆€銆€45銆佺敤閫昏緫浠敾鍑篋瑙﹀彂鍣ㄣ€傦紙濞佺洓VIA2003.11.06涓婃捣绗旇瘯璇曢锛?br/>銆€銆€46銆佺敾鍑篋FF鐨勭粨鏋勫浘,鐢╲erilog瀹炵幇涔嬨€傦紙濞佺洓锛?br/>銆€銆€47銆佺敾鍑轰竴绉岰MOS鐨凞閿佸瓨鍣ㄧ殑鐢佃矾鍥惧拰鐗堝浘銆傦紙鏈煡锛?br/>銆€銆€48銆丏瑙﹀彂鍣ㄥ拰D閿佸瓨鍣ㄧ殑鍖哄埆銆傦紙鏂板お纭欢闈㈣瘯锛?br/>銆€銆€49銆佺畝杩發atch鍜宖ilp-flop鐨勫紓鍚屻€傦紙鏈煡锛?br/>銆€銆€50銆丩ATCH鍜孌FF鐨勬蹇靛拰鍖哄埆銆傦紙鏈煡锛?br/>銆€銆€51銆乴atch涓巖egister鐨勫尯鍒?涓轰粈涔堢幇鍦ㄥ鐢╮egister.琛屼负绾ф弿杩颁腑latch濡備綍浜х敓鐨勩€?br/>銆€銆€锛堝崡灞变箣妗ワ級
銆€銆€52銆佺敤D瑙﹀彂鍣ㄥ仛涓簩鍒嗛ⅵ鐨勭數璺?鍙堥棶浠€涔堟槸鐘舵€佸浘銆傦紙鍗庝负锛?br/>銆€銆€53銆佽鐢诲嚭鐢―瑙﹀彂鍣ㄥ疄鐜?鍊嶅垎棰戠殑閫昏緫鐢佃矾锛燂紙姹夌帇绗旇瘯锛?br/>銆€銆€54銆佹€庢牱鐢―瑙﹀彂鍣ㄣ€佷笌鎴栭潪闂ㄧ粍鎴愪簩鍒嗛鐢佃矾锛燂紙涓滀俊绗旇瘯锛?br/>銆€銆€55銆丠owmanyflip-flopcircuitsareneededtodivideby16?(Intel)16鍒嗛锛?br/>銆€銆€56銆佺敤filp-flop鍜宭ogic-gate璁捐涓€涓?浣嶅姞娉曞櫒锛岃緭鍏arryin鍜宑urrent-stage锛岃緭鍑?br/>銆€銆€carryout鍜宯ext-stage.锛堟湭鐭ワ級
銆€銆€57銆佺敤D瑙﹀彂鍣ㄥ仛涓?杩涘埗鐨勮鏁般€傦紙鍗庝负锛?br/>銆€銆€58銆佸疄鐜癗浣岼ohnsonCounter,N=5銆傦紙鍗楀北涔嬫ˉ锛?br/>銆€銆€59銆佺敤浣犵啛鎮夌殑璁捐鏂瑰紡璁捐涓€涓彲棰勭疆鍒濆€肩殑7杩涘埗寰幆璁℃暟鍣紝15杩涘埗鐨勫憿锛燂紙浠曞叞
銆€銆€寰數瀛愶級
銆€銆€60銆佹暟瀛楃數璺璁″綋鐒跺繀闂甐erilog/VHDL锛屽璁捐璁℃暟鍣ㄣ€傦紙鏈煡锛?br/>銆€銆€61銆丅LOCKINGNONBLOCKING璧嬪€肩殑鍖哄埆銆傦紙鍗楀北涔嬫ˉ锛?br/>銆€銆€62銆佸啓寮傛D瑙﹀彂鍣ㄧ殑verilogmodule銆傦紙鎵櫤鐢靛瓙绗旇瘯锛?br/>銆€銆€moduledff8(clk,reset,d,q);
銆€銆€inputclk;
銆€銆€inputreset;
銆€銆€input[7:0]d;
銆€銆€output[7:0]q;
銆€銆€reg[7:0]q;
銆€銆€always@(posedgeclkorposedgereset)
銆€銆€if(reset)
銆€銆€q<=0;
銆€銆€else
銆€銆€q<=d;
銆€銆€endmodule
銆€銆€63銆佺敤D瑙﹀彂鍣ㄥ疄鐜?鍊嶅垎棰戠殑Verilog鎻忚堪锛?锛堟眽鐜嬬瑪璇曪級
銆€銆€moduledivide2(clk,clk_o,reset);
銆€銆€inputclk,reset;
銆€銆€outputclk_o;
銆€銆€wirein;
銆€銆€regout;
銆€銆€always@(posedgeclkorposedgereset)
銆€銆€if(reset)
銆€銆€out<=0;
銆€銆€else
銆€銆€out<=in;
銆€銆€assignin=~out;
銆€銆€assignclk_o=out;
銆€銆€endmodule
銆€銆€64銆佸彲缂栫▼閫昏緫鍣ㄤ欢鍦ㄧ幇浠g數瀛愯璁′腑瓒婃潵瓒婇噸瑕侊紝璇烽棶锛歛)浣犳墍鐭ラ亾鐨勫彲缂栫▼閫昏緫鍣?br/>銆€銆€浠舵湁鍝簺锛?b)璇曠敤VHDL鎴朧ERILOG銆丄BLE鎻忚堪8浣岲瑙﹀彂鍣ㄩ€昏緫銆傦紙姹夌帇绗旇瘯锛?br/>銆€銆€PAL锛孭LD锛孋PLD锛孎PGA銆?br/>銆€銆€moduledff8(clk,reset,d,q);
銆€銆€inputclk;
銆€銆€inputreset;
銆€銆€inputd;
銆€銆€outputq;
銆€銆€regq;
銆€銆€always@(posedgeclkorposedgereset)
銆€銆€if(reset)
銆€銆€q<=0;
銆€銆€else
銆€銆€q<=d;
銆€銆€endmodule
銆€銆€65銆佽鐢℉DL鎻忚堪鍥涗綅鐨勫叏鍔犳硶鍣ㄣ€?鍒嗛鐢佃矾銆傦紙浠曞叞寰數瀛愶級
銆€銆€66銆佺敤VERILOG鎴朧HDL鍐欎竴娈典唬鐮侊紝瀹炵幇10杩涘埗璁℃暟鍣ㄣ€傦紙鏈煡锛?br/>銆€銆€67銆佺敤VERILOG鎴朧HDL鍐欎竴娈典唬鐮侊紝瀹炵幇娑堥櫎涓€涓猤litch銆傦紙鏈煡锛?br/>銆€銆€68銆佷竴涓姸鎬佹満鐨勯鐩敤verilog瀹炵幇锛堜笉杩囪繖涓姸鎬佹満鐢荤殑瀹炲湪姣旇緝宸紝寰堝鏄撹瑙?br/>銆€銆€鐨勶級銆傦紙濞佺洓VIA2003.11.06涓婃捣绗旇瘯璇曢锛?br/>銆€銆€69銆佹弿杩颁竴涓氦閫氫俊鍙风伅鐨勮璁°€傦紙浠曞叞寰數瀛愶級
銆€銆€70銆佺敾鐘舵€佹満锛屾帴鍙?锛?锛?鍒嗛挶鐨勫崠鎶ユ満锛屾瘡浠芥姤绾?鍒嗛挶銆傦紙鎵櫤鐢靛瓙绗旇瘯锛?br/>銆€銆€71銆佽璁′竴涓嚜鍔ㄥ敭璐ф満绯荤粺锛屽崠soda姘寸殑锛屽彧鑳芥姇杩涗笁绉嶇‖甯侊紝瑕佹纭殑鎵惧洖閽?br/>銆€銆€鏁般€?锛?锛夌敾鍑篺sm锛堟湁闄愮姸鎬佹満锛夛紱锛?锛夌敤verilog缂栫▼锛岃娉曡绗﹀悎fpga璁捐
銆€銆€鐨勮姹傘€傦紙鏈煡锛?br/>銆€銆€72銆佽璁′竴涓嚜鍔ㄩギ鏂欏敭鍗栨満锛岄ギ鏂?0鍒嗛挶锛岀‖甯佹湁5鍒嗗拰10鍒嗕袱绉嶏紝骞惰€冭檻鎵鹃浂锛氾紙1锛?br/>銆€銆€鐢诲嚭fsm锛堟湁闄愮姸鎬佹満锛夛紱锛?锛夌敤verilog缂栫▼锛岃娉曡绗﹀悎fpga璁捐鐨勮姹傦紱锛?锛夎璁?br/>銆€銆€宸ョ▼涓彲浣跨敤鐨勫伐鍏峰強璁捐澶ц嚧杩囩▼銆傦紙鏈煡锛?br/>銆€銆€73銆佺敾鍑哄彲浠ユ娴?0010涓茬殑鐘舵€佸浘,骞秜erilog瀹炵幇涔嬨€傦紙濞佺洓锛?br/>銆€銆€74銆佺敤FSM瀹炵幇101101鐨勫簭鍒楁娴嬫ā鍧椼€傦紙鍗楀北涔嬫ˉ锛?br/>銆€銆€a涓鸿緭鍏ョ锛宐涓鸿緭鍑虹锛屽鏋渁杩炵画杈撳叆涓?101鍒檅杈撳嚭涓?锛屽惁鍒欎负0銆?br/>銆€銆€渚嬪a锛?0001100110110100100110
銆€銆€b锛?0000000000100100000000
銆€銆€璇风敾鍑簊tatemachine锛涜鐢≧TL鎻忚堪鍏秙tatemachine銆傦紙鏈煡锛?br/>銆€銆€75銆佺敤verilogddl妫€娴媠tream涓殑鐗瑰畾瀛楃涓诧紙鍒嗙姸鎬佺敤鐘舵€佹満鍐欙級銆傦紙椋炲埄娴︼紞澶у攼
銆€銆€绗旇瘯锛?br/>銆€銆€76銆佺敤veriloghdl鍐欎竴涓猣ifo鎺у埗鍣?鍖呮嫭绌猴紝婊★紝鍗婃弧淇″彿)銆傦紙椋炲埄娴︼紞澶у攼绗旇瘯锛?br/>銆€銆€77銆佺幇鏈変竴鐢ㄦ埛闇€瑕佷竴绉嶉泦鎴愮數璺骇鍝侊紝瑕佹眰璇ヤ骇鍝佽兘澶熷疄鐜板涓嬪姛鑳斤細y=lnx锛屽叾涓紝x
銆€銆€涓?浣嶄簩杩涘埗鏁存暟杈撳叆淇″彿銆倅涓轰簩杩涘埗灏忔暟杈撳嚭锛岃姹備繚鐣欎袱浣嶅皬鏁般€傜數婧愮數鍘嬩负3~5v鍋?br/>銆€銆€璁惧叕鍙告帴鍒拌椤圭洰鍚庯紝浜ょ敱浣犳潵璐熻矗璇ヤ骇鍝佺殑璁捐锛岃瘯璁ㄨ璇ヤ骇鍝佺殑璁捐鍏ㄧ▼銆傦紙浠曞叞寰?br/>銆€銆€鐢靛瓙锛?br/>銆€銆€78銆乻ram锛宖alshmemory锛屽強dram鐨勫尯鍒紵锛堟柊澶‖浠堕潰璇曪級
銆€銆€79銆佺粰鍑哄崟绠RAM鐨勫師鐞嗗浘(瑗跨數鐗堛€婃暟瀛楃數瀛愭妧鏈熀纭€銆嬩綔鑰呮潹棰傚崕銆佸啹姣涘畼205椤靛浘9
銆€銆€锛?4b)锛岄棶浣犳湁浠€涔堝姙娉曟彁楂榬efreshtime锛屾€诲叡鏈?涓棶棰橈紝璁颁笉璧锋潵浜嗐€傦紙闄嶄綆娓?br/>銆€銆€搴︼紝澧炲ぇ鐢靛瀛樺偍瀹归噺锛夛紙Infineon绗旇瘯锛?br/>銆€銆€80銆丳leasedrawschematicofacommonSRAMcellwith6transistors,pointout
銆€銆€whichnodescanstoredataandwhichnodeiswordlinecontrol?锛堝▉鐩涚瑪璇曢
銆€銆€circuitdesign-beijing-03.11.09锛?br/>銆€銆€81銆佸悕璇?sram,ssram,sdram
銆€銆€鍚嶈瘝IRQ,BIOS,USB,VHDL,SDR
銆€銆€IRQ:InterruptReQuest
銆€銆€BIOS:BasicInputOutputSystem
銆€銆€USB:UniversalSerialBus
銆€銆€VHDL:VHICHardwareDescriptionLanguage
銆€銆€SDR:SingleDataRate
C语言程序设计——课程设计——通讯录管理系统/*10.3.2婧愮▼搴?/
/******澶存枃浠讹紙.h锛?**********/
#include"stdio.h"/*I/O鍑芥暟*/
#include"stdlib.h"/*鏍囧噯搴撳嚱鏁?/
#include"string.h"/*瀛楃涓插嚱鏁?/
#include"ctype.h"/*瀛楃鎿嶄綔鍑芥暟*/
#defineM50/*瀹氫箟甯告暟琛ㄧず璁板綍鏁?/
typedefstruct/*瀹氫箟鏁版嵁缁撴瀯*/
{
charname[20];/*濮撳悕*/
charunits[30];/*鍗曚綅*/
chartele[10];/*鐢佃瘽*/
}ADDRESS;
/******浠ヤ笅鏄嚱鏁板師鍨?******/
intenter(ADDRESSt[]);/*杈撳叆璁板綍*/
voidlist(ADDRESSt[],intn);/*鏄剧ず璁板綍*/
voidsearch(ADDRESSt[],intn);/*鎸夊鍚嶆煡鎵炬樉绀鸿褰?/
intdelete(ADDRESSt[],intn);/*鍒犻櫎璁板綍*/
intadd(ADDRESSt[],intn);/*鎻掑叆璁板綍*/
voidsave(ADDRESSt[],intn);/*璁板綍淇濆瓨涓烘枃浠?/
intload(ADDRESSt[]);/*浠庢枃浠朵腑璇昏褰?/
voiddisplay(ADDRESSt[]);/*鎸夊簭鍙锋煡鎵炬樉绀鸿褰?/
voidsort(ADDRESSt[],intn);/*鎸夊鍚嶆帓搴?/
voidqseek(ADDRESSt[],intn);/*蹇€熸煡鎵捐褰?/
voidcopy();/*鏂囦欢澶嶅埗*/
voidprint(ADDRESStemp);/*鏄剧ず鍗曟潯璁板綍*/
intfind(ADDRESSt[],intn,char*s);/*鏌ユ壘鍑芥暟*/
intmenu_select();/*涓昏彍鍗曞嚱鏁?/
/******涓诲嚱鏁板紑濮?******/
main()
{
inti;
ADDRESSadr[M];/*瀹氫箟缁撴瀯浣撴暟缁?/
intlength;/*淇濆瓨璁板綍闀垮害*/
clrscr();/*娓呭睆*/
for(;;)/*鏃犻檺寰幆*/
{
switch(menu_select())/*璋冪敤涓昏彍鍗曞嚱鏁帮紝杩斿洖鍊兼暣鏁颁綔寮€鍏宠鍙ョ殑鏉′欢*/
{
case0:length=enter(adr);break;/*杈撳叆璁板綍*/
case1:list(adr,length);break;/*鏄剧ず鍏ㄩ儴璁板綍*/
case2:search(adr,length);break;/*鏌ユ壘璁板綍*/
case3:length=delete(adr,length);break;/*鍒犻櫎璁板綍*/
case4:length=add(adr,length);break;/*鎻掑叆璁板綍*/
case5:save(adr,length);break;/*淇濆瓨鏂囦欢*/
case6:length=load(adr);break;/*璇绘枃浠?/
case7:display(adr);break;/*鎸夊簭鍙锋樉绀鸿褰?/
case8:sort(adr,length);break;/*鎸夊鍚嶆帓搴?/
case9:qseek(adr,length);break;/*蹇€熸煡鎵捐褰?/
case10:copy();break;/*澶嶅埗鏂囦欢*/
case11:exit(0);/*濡傝繑鍥炲€间负11鍒欑▼搴忕粨鏉?/
}
}
}
/*鑿滃崟鍑芥暟锛屽嚱鏁拌繑鍥炲€间负鏁存暟锛屼唬琛ㄦ墍閫夌殑鑿滃崟椤?/
menu_select()
{
chars[80];
intc;
gotoxy(1,25);/*灏嗗厜鏍囧畾涓哄湪绗?5琛岋紝绗?鍒?/
printf("pressanykeyentermenu......\n");/*鎻愮ず鍘嬩换鎰忛敭缁х画*/
getch();/*璇诲叆浠绘剰瀛楃*/
clrscr();/*娓呭睆*/
gotoxy(1,1);
printf("********************MENU*********************\n\n");
printf("0.Enterrecord\n");
printf("1.Listthefile\n");
printf("2.Searchrecordonname\n");
printf("3.Deletearecord\n");
printf("4.addrecord\n");
printf("5.Savethefile\n");
printf("6.Loadthefile\n");
printf("7.displayrecordonorder\n");
printf("8.sorttomakenewfile\n");
printf("9.Quickseekrecord\n");
printf("10.copythefiletonewfile\n");
printf("11.Quit\n");
printf("***********************************************\n");
do{
printf("\nEnteryouchoice(0~11):");/*鎻愮ず杈撳叆閫夐」*/
scanf("%s",s);/*杈撳叆閫夋嫨椤?/
c=atoi(s);/*灏嗚緭鍏ョ殑瀛楃涓茶浆鍖栦负鏁村瀷鏁?/
}while(c<0||c>11);/*閫夋嫨椤逛笉鍦?~11涔嬮棿閲嶈緭*/
returnc;/*杩斿洖閫夋嫨椤癸紝涓荤▼搴忔牴鎹鏁拌皟鐢ㄧ浉搴旂殑鍑芥暟*/
}
/***杈撳叆璁板綍锛屽舰鍙備负缁撴瀯浣撴暟缁勶紝鍑芥暟鍊艰繑鍥炵被鍨嬩负鏁村瀷琛ㄧず璁板綍闀垮害*/
intenter(ADDRESSt[])
{
inti,n;
char*s;
clrscr();/*娓呭睆*/
printf("\npleaseinputnum\n");/*鎻愮ず淇℃伅*/
scanf("%d",&n);/*杈撳叆璁板綍鏁?/
printf("pleaseinputrecord\n");/*鎻愮ず杈撳叆璁板綍*/
printf("nameunittelephone\n");
printf("------------------------------------------------\n");
for(i=0;i<n;i++)
{
scanf("%s%s%s",t[i].name,t[i].units,t[i].tele);/*杈撳叆璁板綍*/
printf("----------------------------------------------\n");
}
returnn;/*杩斿洖璁板綍鏉℃暟*/
}
/*鏄剧ず璁板綍锛屽弬鏁颁负璁板綍鏁扮粍鍜岃褰曟潯鏁?/
voidlist(ADDRESSt[],intn)
{
inti;
clrscr();
printf("\n\n*******************ADDRESS******************\n");
printf("nameunittelephone\n");
printf("------------------------------------------------\n");
for(i=0;i<n;i++)
printf("%-20s%-30s%-10s\n",t[i].name,t[i].units,t[i].tele);
if((i+1)==0)/*鍒ゆ柇杈撳嚭鏄惁杈惧埌10鏉¤褰?/
{
printf("Pressanykeycontinue...\n");/*鎻愮ず淇℃伅*/
getch();/*鍘嬩换鎰忛敭缁х画*/
}
printf("************************end*******************\n");
}
/*鏌ユ壘璁板綍*/
voidsearch(ADDRESSt[],intn)
{
chars[20];/*淇濆瓨寰呮煡鎵惧鍚嶅瓧绗︿覆*/
inti;/*淇濆瓨鏌ユ壘鍒扮粨鐐圭殑搴忓彿*/
clrscr();/*娓呭睆*/
printf("pleasesearchname\n");
scanf("%s",s);/*杈撳叆寰呮煡鎵惧鍚?/
i=find(t,n,s);/*璋冪敤find鍑芥暟锛屽緱鍒颁竴涓暣鏁?/
if(i>n-1)/*濡傛灉鏁存暟i鍊煎ぇ浜巒-1锛岃鏄庢病鎵惧埌*/
printf("notfound\n");
else
print(t[i]);/*鎵惧埌锛岃皟鐢ㄦ樉绀哄嚱鏁版樉绀鸿褰?/
}
/*鏄剧ず鎸囧畾鐨勪竴鏉¤褰?/
voidprint(ADDRESStemp)
{
clrscr();
printf("\n\n********************************************\n");
printf("nameunittelephone\n");
printf("------------------------------------------------\n");
printf("%-20s%-30s%-10s\n",temp.name,temp.units,temp.tele);
printf("**********************end***********************\n");
}
/*鏌ユ壘鍑芥暟锛屽弬鏁颁负璁板綍鏁扮粍鍜岃褰曟潯鏁颁互鍙婂鍚峴*/
intfind(ADDRESSt[],intn,char*s)
{
inti;
for(i=0;i<n;i++)/*浠庣涓€鏉¤褰曞紑濮嬶紝鐩村埌鏈€鍚庝竴鏉?/
{
if(strcmp(s,t[i].name)==0)/*璁板綍涓殑濮撳悕鍜屽緟姣旇緝鐨勫鍚嶆槸鍚︾浉绛?/
returni;/*鐩哥瓑锛屽垯杩斿洖璇ヨ褰曠殑涓嬫爣鍙凤紝绋嬪簭鎻愬墠缁撶粨鏉?/
}
returni;/*杩斿洖i鍊?/
}
/*鍒犻櫎鍑芥暟锛屽弬鏁颁负璁板綍鏁扮粍鍜岃褰曟潯鏁?/
intdelete(ADDRESSt[],intn)
{
chars[20];/*瑕佸垹闄よ褰曠殑濮撳悕*/
intch=0;
inti,j;
printf("pleasedeletedname\n");/*鎻愮ず淇℃伅*/
scanf("%s",s);/*杈撳叆濮撳悕*/
i=find(t,n,s);/*璋冪敤find鍑芥暟*/
if(i>n-1)/*濡傛灉i>n-1瓒呰繃浜嗘暟缁勭殑闀垮害*/
printf("nofoundnotdeleted\n");/*鏄剧ず娌℃壘鍒拌鍒犻櫎鐨勮褰?/
else
{
print(t[i]);/*璋冪敤杈撳嚭鍑芥暟鏄剧ず璇ユ潯璁板綍淇℃伅*/
printf("Areyousuredeleteit(1/0)\n");/*纭鏄惁瑕佸垹闄?/
scanf("%d",&ch);/*杈撳叆涓€涓暣鏁?鎴?*/
if(ch==1)/*濡傛灉纭鍒犻櫎鏁存暟涓?*/
{
for(j=i+1;j<n;j++)/*鍒犻櫎璇ヨ褰曪紝瀹為檯鍚庣画璁板綍鍓嶇Щ*/
{
strcpy(t[j-1].name,t[j].name);/*灏嗗悗涓€鏉¤褰曠殑濮撳悕鎷疯礉鍒板墠涓€鏉?/
strcpy(t[j-1].units,t[j].units);/*灏嗗悗涓€鏉¤褰曠殑鍗曚綅鎷疯礉鍒板墠涓€鏉?/
strcpy(t[j-1].tele,t[j].tele);/*灏嗗悗涓€鏉¤褰曠殑鐢佃瘽鎷疯礉鍒板墠涓€鏉?/
}
n--;/*璁板綍鏁板噺1*/
}
}
returnn;/*杩斿洖璁板綍鏁?/
}
/*鎻掑叆璁板綍鍑芥暟锛屽弬鏁颁负缁撴瀯浣撴暟缁勫拰璁板綍鏁?/
intadd(ADDRESSt[],intn)/*鎻掑叆鍑芥暟锛屽弬鏁颁负缁撴瀯浣撴暟缁勫拰璁板綍鏁?/
{
ADDRESStemp;/*鏂版彃鍏ヨ褰曚俊鎭?/
inti,j;
chars[20];/*纭畾鎻掑叆鍦ㄥ摢涓褰曚箣鍓?/
printf("pleaseinputrecord\n");
printf("************************************************\n");
printf("nameunittelephone\n");
printf("--------------------------------------------------\n");
scanf("%s%s%s",temp.name,temp.units,temp.tele);/*杈撳叆鎻掑叆淇℃伅*/
printf("------------------------------------------------\n");
printf("pleaseinputlocatename\n");
scanf("%s",s);/*杈撳叆鎻掑叆浣嶇疆鐨勫鍚?/
i=find(t,n,s);/*璋冪敤find锛岀‘瀹氭彃鍏ヤ綅缃?/
for(j=n-1;j>=i;j--)/*浠庢渶鍚庝竴涓粨鐐瑰紑濮嬪悜鍚庣Щ鍔ㄤ竴鏉?/
{
strcpy(t[j+1].name,t[j].name);/*褰撳墠璁板綍鐨勫鍚嶆嫹璐濆埌鍚庝竴鏉?/
strcpy(t[j+1].units,t[j].units);/*褰撳墠璁板綍鐨勫崟浣嶆嫹璐濆埌鍚庝竴鏉?/
strcpy(t[j+1].tele,t[j].tele);/*褰撳墠璁板綍鐨勭數璇濇嫹璐濆埌鍚庝竴鏉?/
}
strcpy(t[i].name,temp.name);/*灏嗘柊鎻掑叆璁板綍鐨勫鍚嶆嫹璐濆埌绗琲涓綅缃?/
strcpy(t[i].units,temp.units);/*灏嗘柊鎻掑叆璁板綍鐨勫崟浣嶆嫹璐濆埌绗琲涓綅缃?/
strcpy(t[i].tele,temp.tele);/*灏嗘柊鎻掑叆璁板綍鐨勭數璇濇嫹璐濆埌绗琲涓綅缃?/
n++;/*璁板綍鏁板姞1*/
returnn;/*杩斿洖璁板綍鏁?/
}
/*淇濆瓨鍑芥暟锛屽弬鏁颁负缁撴瀯浣撴暟缁勫拰璁板綍鏁?/
voidsave(ADDRESSt[],intn)
{
inti;
FILE*fp;/*鎸囧悜鏂囦欢鐨勬寚閽?/
if((fp=fopen("record.txt","wb"))==NULL)/*鎵撳紑鏂囦欢锛屽苟鍒ゆ柇鎵撳紑鏄惁姝e父*/
{
printf("cannotopenfile\n");/*娌℃墦寮€*/
exit(1);/*閫€鍑?/
}
printf("\nSavingfile\n");/*杈撳嚭鎻愮ず淇℃伅*/
fprintf(fp,"%d",n);/*灏嗚褰曟暟鍐欏叆鏂囦欢*/
fprintf(fp,"\r\n");/*灏嗘崲琛岀鍙峰啓鍏ユ枃浠?/
for(i=0;i<n;i++)
{
fprintf(fp,"%-20s%-30s%-10s",t[i].name,t[i].units,t[i].tele);/*鏍煎紡鍐欏叆璁板綍*/
fprintf(fp,"\r\n");/*灏嗘崲琛岀鍙峰啓鍏ユ枃浠?/
}
fclose(fp);/*鍏抽棴鏂囦欢*/
printf("****savesuccess***\n");/*鏄剧ず淇濆瓨鎴愬姛*/
}
/*璇诲叆鍑芥暟锛屽弬鏁颁负缁撴瀯浣撴暟缁?/
intload(ADDRESSt[])
{
inti,n;
FILE*fp;/*鎸囧悜鏂囦欢鐨勬寚閽?/
if((fp=fopen("record.txt","rb"))==NULL)/*鎵撳紑鏂囦欢*/
{
printf("cannotopenfile\n");/*涓嶈兘鎵撳紑*/
exit(1);/*閫€鍑?/
}
fscanf(fp,"%d",&n);/*璇诲叆璁板綍鏁?/
for(i=0;i<n;i++)
fscanf(fp,"%20s%30ss",t[i].name,t[i].units,t[i].tele);/*鎸夋牸寮忚鍏ヨ褰?/
fclose(fp);/*鍏抽棴鏂囦欢*/
printf("Youhavesuccessreaddatafromfile!!!\n");/*鏄剧ず淇濆瓨鎴愬姛*/
returnn;/*杩斿洖璁板綍鏁?/
}
/*鎸夊簭鍙锋樉绀鸿褰曞嚱鏁?/
voiddisplay(ADDRESSt[])
{
intid,n;
FILE*fp;/*鎸囧悜鏂囦欢鐨勬寚閽?/
if((fp=fopen("record.txt","rb"))==NULL)/*鎵撳紑鏂囦欢*/
{
printf("cannotopenfile\n");/*涓嶈兘鎵撳紑鏂囦欢*/
exit(1);/*閫€鍑?/
}
printf("Enterordernumber...\n");/*鏄剧ず淇℃伅*/
scanf("%d",&id);/*杈撳叆搴忓彿*/
fscanf(fp,"%d",&n);/*浠庢枃浠惰鍏ヨ褰曟暟*/
if(id>=0&&id<n)/*鍒ゆ柇搴忓彿鏄惁鍦ㄨ褰曡寖鍥村唴*/
{
fseek(fp,(id-1)*sizeof(ADDRESS),1);/*绉诲姩鏂囦欢鎸囬拡鍒拌璁板綍浣嶇疆*/
print(t[id]);/*璋冪敤杈撳嚭鍑芥暟鏄剧ず璇ヨ褰?/
printf("\r\n");
}
else
printf("no%dnumberrecord!!!\n",id);/*濡傛灉搴忓彿涓嶅悎鐞嗘樉绀轰俊鎭?/
fclose(fp);/*鍏抽棴鏂囦欢*/
}
/*鎺掑簭鍑芥暟锛屽弬鏁颁负缁撴瀯浣撴暟缁勫拰璁板綍鏁?/
voidsort(ADDRESSt[],intn)
{
inti,j,flag;
ADDRESStemp;/*涓存椂鍙橀噺鍋氫氦鎹㈡暟鎹敤*/
for(i=0;i<n;i++)
{
flag=0;/*璁炬爣蹇楀垽鏂槸鍚﹀彂鐢熻繃浜ゆ崲*/
for(j=0;j<n-1;j++)
if((strcmp(t[j].name,t[j+1].name))>0)/*姣旇緝澶у皬*/
{
flag=1;
strcpy(temp.name,t[j].name);/*浜ゆ崲璁板綍*/
strcpy(temp.units,t[j].units);
strcpy(temp.tele,t[j].tele);
strcpy(t[j].name,t[j+1].name);
strcpy(t[j].units,t[j+1].units);
strcpy(t[j].tele,t[j+1].tele);
strcpy(t[j+1].name,temp.name);
strcpy(t[j+1].units,temp.units);
strcpy(t[j+1].tele,temp.tele);
}
if(flag==0)break;/*濡傛灉鏍囧織涓?锛岃鏄庢病鏈夊彂鐢熻繃浜ゆ崲寰幆缁撴潫*/
}
printf("sortsucess!!!\n");/*鏄剧ず鎺掑簭鎴愬姛*/
}
/*蹇€熸煡鎵撅紝鍙傛暟涓虹粨鏋勪綋鏁扮粍鍜岃褰曟暟*/
voidqseek(ADDRESSt[],intn)
{
chars[20];
intl,r,m;
printf("\nPleasesortbeforeqseek!\n");/*鎻愮ず纭鍦ㄦ煡鎵句箣鍓嶏紝璁板綍鏄惁宸叉帓搴?/
printf("pleaseenternameforqseek\n");/*鎻愮ず杈撳叆*/
scanf("%s",s);/*杈撳叆寰呮煡鎵剧殑濮撳悕*/
l=0;r=n-1;/*璁剧疆宸﹁竟鐣屼笌鍙宠竟鐣岀殑鍒濆€?/
while(l<=r)/*褰撳乏杈圭晫<=鍙宠竟鐣屾椂*/
{
m=(l+r)/2;/*璁$畻涓棿浣嶇疆*/
if(strcmp(t[m].name,s)==0)/*涓庝腑闂寸粨鐐瑰鍚嶅瓧娈靛仛姣旇緝鍒ゆ槸鍚︾浉绛?/
{
print(t[m]);/*濡傛灉鐩哥瓑锛屽垯璋冪敤print鍑芥暟鏄剧ず璁板綍淇℃伅*/
return;/*杩斿洖*/
}
if(strcmp(t[m].name,s)<0)/*濡傛灉涓棿缁撶偣灏?/
l=m+1;/*淇敼宸﹁竟鐣?/
else
r=m-1;/*鍚﹀垯锛屼腑闂寸粨鐐瑰ぇ锛屼慨鏀瑰彸杈圭晫*/
}
if(l>r)/*濡傛灉宸﹁竟鐣屽ぇ浜庡彸杈圭晫鏃?/
printf("notfound\n");/*鏄剧ず娌℃壘鍒?/
}
/*澶嶅埗鏂囦欢*/
voidcopy()
{
charoutfile[20];/*鐩爣鏂囦欢鍚?/
inti,n;
ADDRESStemp[M];/*瀹氫箟涓存椂鍙橀噺*/
FILE*sfp,*tfp;/*瀹氫箟鎸囧悜鏂囦欢鐨勬寚閽?/
clrscr();/*娓呭睆*/
if((sfp=fopen("record.txt","rb"))==NULL)/*鎵撳紑璁板綍鏂囦欢*/
{
printf("cannotopenfile\n");/*鏄剧ず涓嶈兘鎵撳紑鏂囦欢淇℃伅*/
exit(1);/*閫€鍑?/
}
printf("Enteroutfilename,forexamplec:\\f1\\te.txt:\n");/*鎻愮ず淇℃伅*/
scanf("%s",outfile);/*杈撳叆鐩爣鏂囦欢鍚?/
if((tfp=fopen(outfile,"wb"))==NULL)/*鎵撳紑鐩爣鏂囦欢*/
{
printf("cannotopenfile\n");/*鏄剧ず涓嶈兘鎵撳紑鏂囦欢淇℃伅*/
exit(1);/*閫€鍑?/
}
fscanf(sfp,"%d",&n);/*璇诲嚭鏂囦欢璁板綍鏁?/
fprintf(tfp,"%d",n);/*鍐欏叆鐩爣鏂囦欢鏁?/
fprintf(tfp,"\r\n");/*鍐欏叆鎹㈣绗?/
for(i=0;i<n;i++)
{
fscanf(sfp,"%20s%30ss\n",temp[i].name,temp[i].units,
temp[i].tele);/*璇诲叆璁板綍*/
fprintf(tfp,"%-20s%-30s%-10s\n",temp[i].name,
temp[i].units,temp[i].tele);/*鍐欏叆璁板綍*/
fprintf(tfp,"\r\n");/*鍐欏叆鎹㈣绗?/
}
fclose(sfp);/*鍏抽棴婧愭枃浠?/
fclose(tfp);/*鍏抽棴鐩爣鏂囦欢*/
printf("youhavesuccesscopyfile!!!\n");/*鏄剧ず澶嶅埗鎴愬姛*/
}
用友t3运行时错误字符串后的引号不完整杩愯閿欒銆傜敤鍙媡3杩愯鏃堕敊璇瓧绗︿覆???鍚庣殑寮曞彿涓嶅畬鏁存槸鍥犱负杩愯閿欒銆傚畬鏁达紝璇婚煶鏄痺谩nzh臎ng锛屾眽璇瘝璇紝鎰忔€濇槸鍏锋湁鎴栦繚鎸佺潃搴旀湁鐨勯儴鍒嗭紝娌℃湁鎹熷潖鎴栨畫缂恒€?
C语言课程设计瀛楁暟鍙楅檺锛?#include"stdio.h"#include"stdlib.h"#include"string.h"#include"conio.h"#include"mem.h"#include"ctype.h"/#include"alloc.h"#defineN3typedefstructz1
{
charno[11];
charname[15];
intscore[N];
floatsum;
floataverage;
intorder;
structz1*next;
}STUDENT;
STUDENT*init();
STUDENT*create();
STUDENT*delete(STUDENT*h);
voidprint(STUDENT*h);/*鏄剧ず鎵€鏈夎褰?/
voidsearch(STUDENT*h);/*鏌ユ壘*/
voidsave(STUDENT*h);/*淇濆瓨*/
STUDENT*load();/*璇诲叆璁板綍*/
voidcomputer(STUDENT*h);/*璁$畻鎬诲垎鍜屽潎鍒?/
STUDENT*insert(STUDENT*h);/*鎻掑叆璁板綍*/
voidappend();/*杩藉姞璁板綍*/
voidcopy();/*澶嶅埗鏂囦欢*/
STUDENT*sort(STUDENT*h);/*鎺掑簭*/
STUDENT*index(STUDENT*h);/*绱㈠紩*/
voidtotal(STUDENT*h);/*鍒嗙被鍚堣*/
intmenu_select();/*鑿滃崟鍑芥暟*/
/******涓诲嚱鏁板紑濮?******/
main()
{
inti;
STUDENT*head;/*閾捐〃瀹氫箟澶存寚閽?/
head=init();/*鍒濆鍖栭摼琛?/
clrscr();/*娓呭睆*/
for(;;)/*鏃犻檺寰幆*/
{
switch(menu_select())/*璋冪敤涓昏彍鍗曞嚱鏁帮紝杩斿洖鍊兼暣鏁颁綔寮€鍏宠鍙ョ殑鏉′欢*/
{/*鍊间笉鍚岋紝鎵ц鐨勫嚱鏁颁笉鍚岋紝break涓嶈兘鐪佺暐*/
case0:head=init();break;
case1:head=create();break;
case2:head=delete(head);break;
case3:print(head);break;/*鏄剧ず鍏ㄩ儴璁板綍*/
case4:search(head);break;/*鏌ユ壘璁板綍*/
case5:save(head);break;/*淇濆瓨鏂囦欢*/
case6:head=load();break;/*璇绘枃浠?/
case7:computer(head);break;/*璁$畻鎬诲垎鍜屽潎鍒?/
case8:head=insert(head);break;/*鎻掑叆璁板綍*/
case9:copy();break;/*澶嶅埗鏂囦欢*/
case10:head=sort(head);break;/*鎺掑簭*/
case11:append();break;/*杩藉姞璁板綍*/
case12:head=index(head);break;/*绱㈠紩*/
case13:total(head);break;/*鍒嗙被鍚堣*/
case14:exit(0);/*濡傝彍鍗曡繑鍥炲€间负14绋嬪簭缁撴潫*/
}
}
}
/*鑿滃崟鍑芥暟锛岃繑鍥炲€间负鏁存暟*/
menu_select()
{
char*menu[]={"***************MENU***************",/*瀹氫箟鑿滃崟瀛楃涓叉暟缁?/
"0.initlist",/*鍒濆鍖?/
"1.Enterlist",/*杈撳叆璁板綍*/
"2.Deletearecordfromlist",/*浠庤〃涓垹闄よ褰?/
"3.printlist",/*鏄剧ず鍗曢摼琛ㄤ腑鎵€鏈夎褰?/
"4.Searchrecordonname",/*鎸夌収濮撳悕鏌ユ壘璁板綍*/
"5.Savethefile",/*灏嗗崟閾捐〃涓褰曚繚瀛樺埌鏂囦欢涓?/
"6.Loadthefile",/*浠庢枃浠朵腑璇诲叆璁板綍*/
"7.computethescore",/*璁$畻鎵€鏈夊鐢熺殑鎬诲垎鍜屽潎鍒?/
"8.insertrecordtolist",/*鎻掑叆璁板綍鍒拌〃涓?/
"9.copythefiletonewfile",/*澶嶅埗鏂囦欢*/
"10.sorttomakenewfile",/*鎺掑簭*/
"11.appendrecordtofile",/*杩藉姞璁板綍鍒版枃浠朵腑*/
"12.indexonnomber",/*绱㈠紩*/
"13.totalonnomber",/*鍒嗙被鍚堣*/
"14.Quit"};/*閫€鍑?/
chars[3];/*浠ュ瓧绗﹀舰寮忎繚瀛橀€夋嫨鍙?/
intc,i;/*瀹氫箟鏁村舰鍙橀噺*/
gotoxy(1,25);/*绉诲姩鍏夋爣*/
printf("pressanykeyentermenu......\n");/*鍘嬩换涓€閿繘鍏ヤ富鑿滃崟*/
getch();/*杈撳叆浠讳竴閿?/
clrscr();/*娓呭睆骞?/
gotoxy(1,1);/*绉诲姩鍏夋爣*/
textcolor(YELLOW);/*璁剧疆鏂囨湰鏄剧ず棰滆壊涓洪粍鑹?/
textbackground(BLUE);/*璁剧疆鑳屾櫙棰滆壊涓鸿摑鑹?/
gotoxy(10,2);/*绉诲姩鍏夋爣*/
putch(0xc9);/*杈撳嚭宸︿笂瑙掕竟妗嗏攺*/
for(i=1;i<44;i++)
putch(0xcd);/*杈撳嚭涓婅竟妗嗘按骞崇嚎*/
putch(0xbb);/*杈撳嚭鍙充笂瑙掕竟妗?鈹?/
for(i=3;i<20;i++)
{
gotoxy(10,i);putch(0xba);/*杈撳嚭宸﹀瀭鐩寸嚎*/
gotoxy(54,i);putch(0xba);
}/*杈撳嚭鍙冲瀭鐩寸嚎*/
gotoxy(10,20);putch(0xc8);/*杈撳嚭宸︿笂瑙掕竟妗嗏敆*/
for(i=1;i<44;i++)
putch(0xcd);/*杈撳嚭涓嬭竟妗嗘按骞崇嚎*/
putch(0xbc);/*杈撳嚭鍙充笅瑙掕竟妗嗏敍*/
window(11,3,53,19);/*鍒朵綔鏄剧ず鑿滃崟鐨勭獥鍙o紝澶у皬鏍规嵁鑿滃崟鏉℃暟璁捐*/
clrscr();/*娓呭睆*/
for(i=0;i<16;i++)/*杈撳嚭涓昏彍鍗曟暟缁?/
{
gotoxy(10,i+1);
cprintf("%s",menu[i]);
}
textbackground(BLACK);/*璁剧疆鑳屾櫙棰滆壊涓洪粦鑹?/
window(1,1,80,25);/*鎭㈠鍘熺獥鍙eぇ灏?/
gotoxy(10,21);/*绉诲姩鍏夋爣*/
do{
printf("\nEnteryouchoice(0~14):");/*鍦ㄨ彍鍗曠獥鍙e鏄剧ず鎻愮ず淇℃伅*/
scanf("%s",s);/*杈撳叆閫夋嫨椤?/
c=atoi(s);/*灏嗚緭鍏ョ殑瀛楃涓茶浆鍖栦负鏁村舰鏁?/
}while(c<0||c>14);/*閫夋嫨椤逛笉鍦?~14涔嬮棿閲嶈緭*/
returnc;/*杩斿洖閫夋嫨椤癸紝涓荤▼搴忔牴鎹鏁拌皟鐢ㄧ浉搴旂殑鍑芥暟*/
}
STUDENT*init()
{
returnNULL;
}
/*鍒涘缓閾捐〃*/
STUDENT*create()
{
inti;ints;
STUDENT*h=NULL,*info;/*STUDENT鎸囧悜缁撴瀯浣撶殑鎸囬拡*/
for(;;)
{
info=(STUDENT*)malloc(sizeof(STUDENT));/*鐢宠绌洪棿*/
if(!info)/*濡傛灉鎸囬拡info涓虹┖*/
{
printf("\noutofmemory");/*杈撳嚭鍐呭瓨婧㈠嚭*/
returnNULL;/*杩斿洖绌烘寚閽?/
}
inputs("enterno:",info->no,11);/*杈撳叆瀛﹀彿骞舵牎楠?/
if(info->no[0]=='@')break;/*濡傛灉瀛﹀彿棣栧瓧绗︿负@鍒欑粨鏉熻緭鍏?/
inputs("entername:",info->name,15);/*杈撳叆濮撳悕锛屽苟杩涜鏍¢獙*/
printf("pleaseinput%dscore\n",N);/*鎻愮ず寮€濮嬭緭鍏ユ垚缁?/
s=0;/*璁$畻姣忎釜瀛︾敓鐨勬€诲垎锛屽垵鍊间负0*/
for(i=0;i<N;i++)/*N闂ㄨ绋嬪惊鐜疦娆?/
{
do{
printf("score%d:",i+1);/*鎻愮ず杈撳叆绗嚑闂ㄨ绋?/
scanf("%d",&info->score[i]);
if(info->score[i]>100||info->score[i]<0)
printf("baddata,repeatinput\n");
}while(info->score[i]>100||info->score[i]<0);
s=s+info->score[i];
}
info->sum=s;
info->average=(float)s/N;
info->order=0;
info->next=h;
h=info;}
return(h);/*杩斿洖澶存寚閽?/
}
/*杈撳叆瀛楃涓诧紝骞惰繘琛岄暱搴﹂獙璇?/
inputs(char*prompt,char*s,intcount)
{
charp[255];
do{
printf(prompt);/*鏄剧ず鎻愮ず淇℃伅*/
scanf("%s",p);if(strlen(p)>count)printf("\ntoolong!\n");}while(strlen(p)>count);
strcpy(s,p);}
voidprint(STUDENT*h)
{
inti=0;/*缁熻璁板綍鏉℃暟*/
STUDENT*p;/*绉诲姩鎸囬拡*/
clrscr();/*娓呭睆*/
p=h;/*鍒濆€间负澶存寚閽?/
printf("\n\n\n****************************STUDENT********************************\n");
printf("|rec|nO|name|sc1|sc2|sc3|sum|ave|order|\n");
printf("|---|----------|---------------|----|----|----|--------|-------|-----|\n");
while(p!=NULL)
{
i++;
printf("|%3d|%-10s|%-15s|%4d|%4d|%4d|%4.2f|%4.2f|%3d|\n",i,p->no,p->name,p->score[0],p->score[1],
p->score[2],p->sum,p->average,p->order);
p=p->next;
}
printf("**********************************end*********************************\n");
}
/*鍒犻櫎璁板綍*/
STUDENT*delete(STUDENT*h)
{
STUDENT*p,*q;/*p涓烘煡鎵惧埌瑕佸垹闄ょ殑缁撶偣鎸囬拡锛宷涓哄叾鍓嶉┍鎸囬拡*/
chars[11];/*瀛樻斁瀛﹀彿*/
clrscr();/*娓呭睆*/
printf("pleasedeletedno\n");/*鏄剧ず鎻愮ず淇℃伅*/
scanf("%s",s);/*杈撳叆瑕佸垹闄よ褰曠殑瀛﹀彿*/
q=p=h;/*缁檘鍜宲璧嬪垵鍊煎ご鎸囬拡*/
while(strcmp(p->no,s)&&p!=NULL)/*褰撹褰曠殑瀛﹀彿涓嶆槸瑕佹壘鐨勶紝鎴栨寚閽堜笉涓虹┖鏃?/
{
q=p;/*灏唒鎸囬拡鍊艰祴缁檘浣滀负p鐨勫墠椹辨寚閽?/
p=p->next;/*灏唒鎸囬拡鎸囧悜涓嬩竴鏉¤褰?/
}
if(p==NULL)/*濡傛灉p涓虹┖锛岃鏄庨摼琛ㄤ腑娌℃湁璇ョ粨鐐?/
printf("\nlistno%sstudent\n",s);
else/*p涓嶄负绌猴紝鏄剧ず鎵惧埌鐨勮褰曚俊鎭?/
{
printf("*****************************havefound***************************\n");
printf("|no|name|sc1|sc2|sc3|sum|ave|order|\n");
printf("|----------|---------------|----|----|----|--------|-------|-----|\n");
printf("|%-10s|%-15s|%4d|%4d|%4d|%4.2f|%4.2f|%3d|\n",p->no,
p->name,p->score[0],p->score[1],p->score[2],p->sum,
p->average,p->order);
printf("********************************end*******************************\n");
getch();/*鍘嬩换涓€閿悗锛屽紑濮嬪垹闄?/
if(p==h)/*濡傛灉p==h锛岃鏄庤鍒犵粨鐐规槸澶寸粨鐐?/
h=p->next;/*淇敼澶存寚閽堟寚鍚戜笅涓€鏉¤褰?/
else
q->next=p->next;/*涓嶆槸澶存寚閽堬紝灏唒鐨勫悗缁х粨鐐逛綔涓簈鐨勫悗缁х粨鐐?/
free(p);/*閲婃斁p鎵€鎸囩粨鐐圭┖闂?/
printf("\nhavedeletedNo%sstudent\n",s);
printf("Don'tforgetsave\n");/*鎻愮ず鍒犻櫎鍚庝笉瑕佸繕璁颁繚瀛樻枃浠?/
}
return(h);/*杩斿洖澶存寚閽?/
}
/*鏌ユ壘璁板綍*/
voidsearch(STUDENT*h)
{
STUDENT*p;chars[15];clrscr();
printf("pleaseenternameforsearch\n");
scanf("%s",s);/*杈撳叆濮撳悕*/
p=h;/*灏嗗ご鎸囬拡璧嬬粰p*/
while(strcmp(p->name,s)&&p!=NULL)/*褰撹褰曠殑濮撳悕涓嶆槸瑕佹壘鐨勶紝鎴栨寚閽堜笉涓虹┖鏃?/
p=p->next;/*绉诲姩鎸囬拡锛屾寚鍚戜笅涓€缁撶偣*/
if(p==NULL)/*濡傛灉鎸囬拡涓虹┖*/
printf("\nlistno%sstudent\n",s);/*鏄剧ず娌℃湁璇ュ鐢?/
else/*鏄剧ず鎵惧埌鐨勮褰曚俊鎭?/
{
printf("\n\n*****************************havefound***************************\n");
printf("|nO|name|sc1|sc2|sc3|sum|ave|order|\n");
printf("|----------|---------------|----|----|----|--------|-------|-----|\n");
printf("|%-10s|%-15s|%4d|%4d|%4d|%4.2f|%4.2f|%3d|\n",p->no,
p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
printf("********************************end*******************************\n");
}
}
/*鎻掑叆璁板綍*/
STUDENT*insert(STUDENT*h)
{
STUDENT*p,*q,*info;/*p鎸囧悜鎻掑叆浣嶇疆锛宷鏄叾鍓嶉┍锛宨nfo鎸囨柊鎻掑叆璁板綍*/
chars[11];/*淇濆瓨鎻掑叆鐐逛綅缃殑瀛﹀彿*/
ints1,i;
printf("pleaseenterlocationbeforetheno\n");
scanf("%s",s);/*杈撳叆鎻掑叆鐐瑰鍙?/
printf("\npleasenewrecord\n");/*鎻愮ず杈撳叆璁板綍淇℃伅*/
info=(STUDENT*)malloc(sizeof(STUDENT));/*鐢宠绌洪棿*/
if(!info)
{
printf("\noutofmemory");/*濡傛病鏈夌敵璇峰埌锛屽唴瀛樻孩鍑?/
returnNULL;/*杩斿洖绌烘寚閽?/
}
inputs("enterno:",info->no,11);/*杈撳叆瀛﹀彿*/
inputs("entername:",info->name,15);/*杈撳叆濮撳悕*/
printf("pleaseinput%dscore\n",N);/*鎻愮ず杈撳叆鍒嗘暟*/
s1=0;/*淇濆瓨鏂拌褰曠殑鎬诲垎锛屽垵鍊间负0*/
for(i=0;i<N;i++)/*N闂ㄨ绋嬪惊鐜疦娆¤緭鍏ユ垚缁?/
{
do{/*瀵规暟鎹繘琛岄獙璇侊紝淇濊瘉鍦?~100涔嬮棿*/
printf("score%d:",i+1);
scanf("%d",&info->score[i]);
if(info->score[i]>100||info->score[i]<0)
printf("baddata,repeatinput\n");
}while(info->score[i]>100||info->score[i]<0);
s1=s1+info->score[i];/*璁$畻鎬诲垎*/
}
info->sum=s1;/*灏嗘€诲垎瀛樺叆鏂拌褰曚腑*/
info->average=(float)s1/N;/*璁$畻鍧囧垎*/
info->order=0;/*鍚嶆璧嬪€?*/
info->next=NULL;/*璁惧悗缁ф寚閽堜负绌?/
p=h;/*灏嗘寚閽堣祴鍊肩粰p*/
q=h;/*灏嗘寚閽堣祴鍊肩粰q*/
while(strcmp(p->no,s)&&p!=NULL)/*鏌ユ壘鎻掑叆浣嶇疆*/
{
q=p;/*淇濆瓨鎸囬拡p锛屼綔涓轰笅涓€涓猵鐨勫墠椹?/
p=p->next;/*灏嗘寚閽坧鍚庣Щ*/
}
if(p==NULL)/*濡傛灉p鎸囬拡涓虹┖锛岃鏄庢病鏈夋寚瀹氱粨鐐?/
if(p==h)/*鍚屾椂p绛変簬h锛岃鏄庨摼琛ㄤ负绌?/
h=info;/*鏂拌褰曞垯涓哄ご缁撶偣*/
else
q->next=info;else
if(p==h){
info->next=p;h=info;}
else
{
info->next=p;q->next=info;
}
printf("\n----haveinserted%sstudent----\n",info->name);printf("---Don'tforgetsave---\n");/*鎻愮ず瀛樼洏*/
return(h);/*杩斿洖澶存寚閽?/
}
/*淇濆瓨鏁版嵁鍒版枃浠?/
voidsave(STUDENT*h)
{
FILE*fp;/*瀹氫箟鎸囧悜鏂囦欢鐨勬寚閽?/
STUDENT*p;/*瀹氫箟绉诲姩鎸囬拡*/
charoutfile[10];/*淇濆瓨杈撳嚭鏂囦欢鍚?/
printf("Enteroutfilename,forexamplec:\\f1\\te.txt:\n");/*鎻愮ず鏂囦欢鍚嶆牸寮忎俊鎭?/
scanf("%s",outfile);
if((fp=fopen(outfile,"wb"))==NULL)/*涓鸿緭鍑烘墦寮€涓€涓簩杩涘埗鏂囦欢锛屽娌℃湁鍒欏缓绔?/
{
printf("cannotopenfile\n");
exit(1);
}
printf("\nSavingfile......\n");/*鎵撳紑鏂囦欢锛屾彁绀烘鍦ㄤ繚瀛?/
p=h;/*绉诲姩鎸囬拡浠庡ご鎸囬拡寮€濮?/
while(p!=NULL)/*濡俻涓嶄负绌?/
{
fwrite(p,sizeof(STUDENT),1,fp);/*鍐欏叆涓€鏉¤褰?/
p=p->next;/*鎸囬拡鍚庣Щ*/
}
fclose(fp);/*鍏抽棴鏂囦欢*/
printf("-----savesuccess!!-----\n");/*鏄剧ず淇濆瓨鎴愬姛*/
}
/*浠庢枃浠惰鏁版嵁*/
STUDENT*load()
{
STUDENT*p,*q,*h=NULL;/*瀹氫箟璁板綍鎸囬拡鍙橀噺*/
FILE*fp;/*瀹氫箟鎸囧悜鏂囦欢鐨勬寚閽?/
charinfile[10];/*淇濆瓨鏂囦欢鍚?/
printf("Enterinfilename,forexamplec:\\f1\\te.txt:\n");scanf("%s",infile);/*杈撳叆鏂囦欢鍚?/
if((fp=fopen(infile,"rb"))==NULL)/*鎵撳紑涓€涓簩杩涘埗鏂囦欢锛屼负璇绘柟寮?/
{
printf("cannotopenfile\n");/*濡備笉鑳芥墦寮€锛屽垯缁撴潫绋嬪簭*/
exit(1);
}
printf("\n-----Loadingfile!-----\n");
p=(STUDENT*)malloc(sizeof(STUDENT));/*鐢宠绌洪棿*/
if(!p)
{
printf("outofmemory!\n");/*濡傛病鏈夌敵璇峰埌锛屽垯鍐呭瓨婧㈠嚭*/
returnh;/*杩斿洖绌哄ご鎸囬拡*/
}
h=p;/*鐢宠鍒扮┖闂达紝灏嗗叾浣滀负澶存寚閽?/
while(!feof(fp))/*寰幆璇绘暟鎹洿鍒版枃浠跺熬缁撴潫*/
{
if(1!=fread(p,sizeof(STUDENT),1,fp))
break;/*濡傛灉娌¤鍒版暟鎹紝璺冲嚭寰幆*/
p->next=(STUDENT*)malloc(sizeof(STUDENT));/*涓轰笅涓€涓粨鐐圭敵璇风┖闂?/
if(!p->next)
{
printf("outofmemory!\n");returnh;
}
q=p;p=p->next;}
q->next=NULL;/*鏈€鍚庝竴涓粨鐐圭殑鍚庣户鎸囬拡涓虹┖*/
fclose(fp);/*鍏抽棴鏂囦欢*/
printf("---Youhavesuccessreaddatafromfile!!!---\n");
returnh;/*杩斿洖澶存寚閽?/
}
/*杩藉姞璁板綍鍒版枃浠?/
voidappend()
{
FILE*fp;/*瀹氫箟鎸囧悜鏂囦欢鐨勬寚閽?/
STUDENT*info;/*鏂拌褰曟寚閽?/
ints1,i;
charinfile[10];/*淇濆瓨鏂囦欢鍚?/
printf("\npleasenewrecord\n");
info=(STUDENT*)malloc(sizeof(STUDENT));/*鐢宠绌洪棿*/
if(!info)
{
printf("\noutofmemory");/*娌℃湁鐢宠鍒帮紝鍐呭瓨婧㈠嚭鏈嚱鏁扮粨鏉?/
return;
}
inputs("enterno:",info->no,11);/*璋冪敤inputs杈撳叆瀛﹀彿*/
inputs("entername:",info->name,15);/*璋冪敤inputs杈撳叆濮撳悕*/
printf("pleaseinput%dscore\n",N);/*鎻愮ず杈撳叆鎴愮哗*/
s1=0;
for(i=0;i<N;i++)
{
do{
printf("score%d:",i+1);
scanf("%d",&info->score[i]);/*杈撳叆鎴愮哗*/
if(info->score[i]>100||info->score[i]<0)printf("baddata,repeatinput\n");
}while(info->score[i]>100||info->score[i]<0);/*鎴愮哗鏁版嵁楠岃瘉*/
s1=s1+info->score[i];/*姹傛€诲垎*/
}
info->sum=s1;/*淇濆瓨鎬诲垎*/
info->average=(float)s1/N;/*姹傚潎鍒?/
info->order=0;/*鍚嶆鍒濆鍊间负0*/
info->next=NULL;/*灏嗘柊璁板綍鍚庣户鎸囬拡璧嬪€间负绌?/
printf("Enterinfilename,forexamplec:\\f1\\te.txt:\n");scanf("%s",infile);/*杈撳叆鏂囦欢鍚?/
if((fp=fopen(infile,"ab"))==NULL)/*鍚戜簩杩涘埗鏂囦欢灏惧鍔犳暟鎹柟寮忔墦寮€鏂囦欢*/
{
printf("cannotopenfile\n");/*鏄剧ず涓嶈兘鎵撳紑*/
exit(1);/*閫€鍑虹▼搴?/
}
printf("\n-----Appendingrecord!-----\n");
if(1!=fwrite(info,sizeof(STUDENT),1,fp))/*鍐欐枃浠舵搷浣?/
{
printf("-----filewriteerror!-----\n");
return;/*杩斿洖*/
}
printf("-----appendsucess!!----\n");
fclose(fp);/*鍏抽棴鏂囦欢*/
}
/*鏂囦欢鎷疯礉*/
voidcopy()
{
charoutfile[10],infile[10];
FILE*sfp,*tfp;/*婧愬拰鐩爣鏂囦欢鎸囬拡*/
STUDENT*p=NULL;/*绉诲姩鎸囬拡*/
clrscr();/*娓呭睆*/
printf("Enterinfilename,forexamplec:\\f1\\te.txt:\n");
scanf("%s",infile);/*杈撳叆婧愭枃浠跺悕*/
if((sfp=fopen(infile,"rb"))==NULL)/*浜岃繘鍒惰鏂瑰紡鎵撳紑婧愭枃浠?/
{
printf("cannotopeninputfile\n");
exit(0);
}
printf("Enteroutfilename,forexamplec:\\f1\\te.txt:\n");/*鎻愮ず杈撳叆鐩爣鏂囦欢鍚?/
scanf("%s",outfile);/*杈撳叆鐩爣鏂囦欢鍚?/
if((tfp=fopen(outfile,"wb"))==NULL)/*浜岃繘鍒跺啓鏂瑰紡鎵撳紑鐩爣鏂囦欢*/
{
printf("cannotopenoutputfile\n");
exit(0);
}
while(!feof(sfp))/*璇绘枃浠剁洿鍒版枃浠跺熬*/
{
if(1!=fread(p,sizeof(STUDENT),1,sfp))
break;/*鍧楄*/
fwrite(p,sizeof(STUDENT),1,tfp);/*鍧楀啓*/
}
fclose(sfp);/*鍏抽棴婧愭枃浠?/
fclose(tfp);/*鍏抽棴鐩爣鏂囦欢*/
printf("youhavesuccesscopyfile!!!\n");/*鏄剧ず鎴愬姛鎷疯礉*/
}
/*鎺掑簭*/
STUDENT*sort(STUDENT*h)
{
inti=0;/*淇濆瓨鍚嶆*/
STUDENT*p,*q,*t,*h1;/*瀹氫箟涓存椂鎸囬拡*/
h1=h->next;/*灏嗗師琛ㄧ殑澶存寚閽堟墍鎸囩殑涓嬩竴涓粨鐐逛綔澶存寚閽?/
h->next=NULL;/*绗竴涓粨鐐逛负鏂拌〃鐨勫ご缁撶偣*/
while(h1!=NULL)/*褰撳師琛ㄤ笉涓虹┖鏃讹紝杩涜鎺掑簭*/
{
t=h1;/*鍙栧師琛ㄧ殑澶寸粨鐐?/
h1=h1->next;/*鍘熻〃澶寸粨鐐规寚閽堝悗绉?/
p=h;/*璁惧畾绉诲姩鎸囬拡p锛屼粠澶存寚閽堝紑濮?/
q=h;/*璁惧畾绉诲姩鎸囬拡q鍋氫负p鐨勫墠椹憋紝鍒濆€间负澶存寚閽?/
while(t->sum<p->sum&&p!=NULL)/*浣滄€诲垎姣旇緝*/
{
q=p;/*寰呮帓搴忕偣鍊煎皬锛屽垯鏂拌〃鎸囬拡鍚庣Щ*/
p=p->next;
}
if(p==q)/*p==q锛岃鏄庡緟鎺掑簭鐐瑰€煎ぇ锛屽簲鎺掑湪棣栦綅*/
{
t->next=p;/*寰呮帓搴忕偣鐨勫悗缁т负p*/
h=t;/*鏂板ご缁撶偣涓哄緟鎺掑簭鐐?/
}
else/*寰呮帓搴忕偣搴旀彃鍏ュ湪涓棿鏌愪釜浣嶇疆q鍜宲涔嬮棿锛屽p涓虹┖鍒欐槸灏鹃儴*/
{
t->next=p;/*t鐨勫悗缁ф槸p*/
q->next=t;/*q鐨勫悗缁ф槸t*/
}
}
p=h;/*宸叉帓濂藉簭鐨勫ご鎸囬拡璧嬬粰p锛屽噯澶囧~鍐欏悕娆?/
while(p!=NULL)/*褰損涓嶄负绌烘椂锛岃繘琛屼笅鍒楁搷浣?/
{
i++;/*缁撶偣搴忓彿*/
p->order=i;/*灏嗗悕娆¤祴鍊?/
p=p->next;/*鎸囬拡鍚庣Щ*/
}
printf("sortsucess!!!\n");/*鎺掑簭鎴愬姛*/
returnh;/*杩斿洖澶存寚閽?/
}
/*璁$畻鎬诲垎鍜屽潎鍊?/
voidcomputer(STUDENT*h)
{
STUDENT*p;/*瀹氫箟绉诲姩鎸囬拡*/
inti=0;/*淇濆瓨璁板綍鏉℃暟鍒濆€间负0*/
longs=0;/*鎬诲垎鍒濆€间负0*/
floataverage=0;/*鍧囧垎鍒濆€间负0*/
p=h;/*浠庡ご鎸囬拡寮€濮?/
while(p!=NULL)/*褰損涓嶄负绌烘椂澶勭悊*/
{
s+=p->sum;/*绱姞鎬诲垎*/
i++;/*缁熻璁板綍鏉℃暟*/
p=p->next;/*鎸囬拡鍚庣Щ*/
}
average=(float)s/i;/*姹傚潎鍒嗭紝鍧囧垎涓烘诞鐐规暟锛屾€诲垎涓烘暣鏁帮紝鎵€浠ュ仛绫诲瀷杞崲*/
printf("\n--Allstudentssumscoreis:%ldaverageis%5.2f\n",s,average);
}
/*绱㈠紩*/
STUDENT*index(STUDENT*h)
{
STUDENT*p,*q,*t,*h1;/*瀹氫箟涓存椂鎸囬拡*/
h1=h->next;/*灏嗗師琛ㄧ殑澶存寚閽堟墍鎸囩殑涓嬩竴涓粨鐐逛綔澶存寚閽?/
h->next=NULL;/*绗竴涓粨鐐逛负鏂拌〃鐨勫ご缁撶偣*/
while(h1!=NULL)/*褰撳師琛ㄤ笉涓虹┖鏃讹紝杩涜鎺掑簭*/
{
t=h1;/*鍙栧師琛ㄧ殑澶寸粨鐐?/
h1=h1->next;/*鍘熻〃澶寸粨鐐规寚閽堝悗绉?/
p=h;/*璁惧畾绉诲姩鎸囬拡p锛屼粠澶存寚閽堝紑濮?/
q=h;/*璁惧畾绉诲姩鎸囬拡q鍋氫负p鐨勫墠椹憋紝鍒濆€间负澶存寚閽?/
while(strcmp(t->no,p->no)>0&&p!=NULL)/*浣滃鍙锋瘮杈?/
{
q=p;p=p->next;
}
if(p==q)/*p==q锛?{
t->next=p;h=t;}
else{
t->next=p;/*t鐨勫悗缁ф槸p*/
q->next=t;/*q鐨勫悗缁ф槸t*/
}
}
printf("indexsucess!!!\n");/*绱㈠紩鎺掑簭鎴愬姛*/
returnh;/*杩斿洖澶存寚閽?/
}
/*鍒嗙被鍚堣*/
voidtotal(STUDENT*h)
{
STUDENT*p,*q;/*瀹氫箟涓存椂鎸囬拡鍙橀噺*/
charsno[9],qno[9],*ptr;/*淇濆瓨鐝骇鍙风殑*/
floats1,ave;/*淇濆瓨鎬诲垎鍜屽潎鍒?/
inti;clrscr();/*娓呭睆*/
printf("\n\n*******************Total*****************\n");
printf("---class---------sum--------------average----\n");
p=h;while(p!=NULL)
{
memcpy(sno,p->no,8);/*浠庡鍙蜂腑鍙栧嚭鐝骇鍙?/
sno[8]='\0';/*鍋氬瓧绗︿覆缁撴潫鏍囪*/
q=p->next;/*灏嗘寚閽堟寚鍚戝緟姣旇緝鐨勮褰?/
s1=p->sum;/*褰撳墠鐝骇鐨勬€诲垎鍒濆€间负璇ョ彮绾х殑绗竴鏉¤褰曟€诲垎*/
ave=p->average;/*褰撳墠鐝骇鐨勫潎鍒嗗垵鍊间负璇ョ彮绾х殑绗竴鏉¤褰曞潎鍒?/
i=1;/*缁熻褰撳墠鐝骇浜烘暟*/
while(q!=NULL)/*鍐呭惊鐜紑濮?/
{
memcpy(qno,q->no,8);/*璇诲彇鐝骇鍙?/
qno[8]='\0';/*鍋氬瓧绗︿覆缁撴潫鏍囪*/
if(strcmp(qno,sno)==0)/*姣旇緝鐝骇鍙?/
{
s1+=q->sum;/*绱姞鎬诲垎*/
ave+=q->average;/*绱姞鍧囧垎*/
i++;/*绱姞鐝骇浜烘暟*/
q=q->next;/*鎸囬拡鎸囧悜涓嬩竴鏉¤褰?/
}
else
break;}
printf("%s.2f%5.2f\n",sno,s1,ave/i);
if(q==NULL)
break;else
p=q;}
printf("---------------------------------------------\n");
}
OK,本文到此结束,希望对大家有所帮助。