Ai
1 Star 0 Fork 0

lxkeepcoding/codingone

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1.cpp 105.25 KB
一键复制 编辑 原始数据 按行查看 历史
付声 提交于 2021-08-05 00:55 +08:00 . codingone
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427
//#define _CRT_SECURE_NO_WARNINGS 1
/*********************************************************
默认参数类型
**********************************************************/
//#include<iostream>
//#include<iomanip>
//using namespace std;
//
//void print(int *parry, int count, int num);
//int main()
//{
// int i_arry[15], count;
// cout << "please input some number:\n";
// count = 0;
// while (cin >> i_arry[count])
// {
// count++;
// if (count >= 15)
// break;
// }
// cout << "use default paramer:\n";
// print(i_arry, count, 5);
// cout << "dont :\n";
// print(i_arry, count, 6);
// return 0;
//}
//void print(int *parry, int count, int num)
//{
// for (int i = 0; i < count; i++)
// {
// cout << setw(5) << *(parry + i);
// if ((i + 1) % num == 0)
// cout << "\n";
// }
// cout << "\n";
//}
/*********************************************************
演示默认参数值和重载函数的使用
**********************************************************/
//#include<iostream>
//#include<iomanip>
//using namespace std;
//int sum_arry(int arry[], int count)
//{
// int sum = 0;
// for (int i = 0; i < count; i++)
// sum += arry[i];
// return sum;
//}
//void print(int arry[], int count)
//{
// for (int i = 0; i < count; i++)
// cout << setw(5) << arry[i];
//}
//void print(int value)
//{
// cout << setw(10) << value;
//}
//int main()
//{
// int arry[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
// int count = 9;
// int value = sum_arry(arry, count);
// if (value > 100)
// print(arry, count);
// else
// print(value);
// return 0;
//}
/*
//常用流状态符演示
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
cout<<showpos<<12<<" "<<34<<noshowpos<<endl;//showpos显示正号
cout<<hex<<18<<" "<<16<<noshowpos<<endl;//hex显示16进制
cout<<dec<<left<<setw(5)<<5<<setw(5)<<6<<endl;//十进制显示整数
cout<<right<<setw(5)<<5<<setw(5)<<6<<endl;
cout<<showpoint<<12.0<<" "<<13.0<<endl;//输出浮点
cout<<14.01<<" "<<15.04<<endl;
cout<<fixed<<14.01<<" "<<15.04<<endl;//定点显示
cout<<scientific<<14.01<<" "<<15.04<<endl;//尾数和指数
//带参数的常用流状态
cout.width(6);//设置显示宽度
cout<<5<<endl;
cout.fill('x');//设置填充字符
cout.width(6);
cout<<6;
cout.width(4);
cout<<7<<endl;
cout.width(4);
cout.fill(' ');
cout<<7<<endl;
cout.precision(4);//设置有效精度
cout<<12.011234<<endl;
cout<<fixed<<13.0212345<<endl;
//与插入运算符连用的流状态
cout<<setw(5)<<5<<endl;
cout<<setfill('x')<<setw(4)<<7<<endl;//设置填充字符
cout<<setprecision(4)<<12.011234<<endl;//设置有效位数或精度
cout<<fixed<<13.0212345<<endl;
return 0;
}
*/
/****************************************************
文件操作演示
****************************************************/
//#include<iostream>
//#include<fstream>
//#include<iomanip>
//using namespace std;
//int main()
//{
// ifstream fin("C:\\Users\\卢鑫\\Desktop\\1.txt", ios_base::in);
// if (!fin)
// {
// cout << "can't open" << endl;
// exit(0);
// }
// ofstream fout("result.txt", ios_base::out);
// if (!fout)
// {
// cout << "can't open successfully" << endl;
// exit(0);
// }
// int i_arry[100];
// int count = 0;
// while (fin >> i_arry[count])
// {
// count++;
// if (count >= 100)
// break;
// }
// for (int i = 0; i<count; i++)
// {
// cout << setw(5) << i_arry[i];
// if ((i + 1) % 8 == 0)
// cout << "\n";
// }
// return 0;
//}
/****************************************************
演示异常的基本操作
****************************************************/
//#include<iostream>
//#include<string>
//using namespace std;
//int strtoint(const string &str)
//{
// int num = 0;
// for (unsigned int i = 0; i < str.length(); i++)
// {
// if ((str.at(i) >= '0') && (str.at(i) <= '9'))
// {
// num = num * 10 + str.at(i) - '0';
// }
// else
// {
// throw str.at(i);
// }
// }
// return num;
//}
//int main()
//{
// string str;
// int i_value;
// cout << "please input a number string :\n";
// cin >> str;
// try
// {
// i_value = strtoint(str);
// if (i_value > 10000)
// throw i_value;
// }
// catch (char c)
// {
// cout << "input string include illegal character:"<<c << endl;
// i_value = -1;
// }
// catch (int)
// {
// cout << "number is too big:" << endl;
// }
// cout << i_value << endl;
// return 0;
//}
/****************************************************
类的定义
****************************************************/
//#include<iostream>
//using namespace std;
//class Date
//{
//private:
// int year;
// int month;
// int day;
//public:
// inline void init_date(int y, int m, int d);
// bool is_leap_year()
// {
// if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
// return true;
// else
// return false;
// }
// void print()
// {
// cout << year << "-" << month << "-" << day << endl;
// }
//
//};
//void Date::init_date(int y, int m, int d)
//{
// year = y;
// month = m;
// day = d;
//}
//void main()
//{
// Date today, yesterday, tommorrow;
// today.init_date(2015, 2, 28);
// yesterday.init_date(2015, 2, 27);
// if (today.is_leap_year())
// tommorrow.init_date(2015, 2, 29);
// else
// tommorrow.init_date(2015, 3, 1);
// yesterday.print();
// today.print();
// tommorrow.print();
//}
/*****************************************************
类的构造函数
******************************************************/
//#include<iostream>
//using namespace std;
//class Date
//{
//private :
// int year;
// int month;
// int day;
//public:
// void init_date(int y, int m, int d)
// {
// year = y;
// month = m;
// day = d;
// }
// bool is_leap_year()
// {
// if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
// return true;
// else
// return false;
// }
// void print()
// {
// cout << year << "-" << month << "-" << day << endl;
// }
//};
//void main()
//{
// Date oneday;
// oneday.print();
// oneday.print();
// oneday.init_date(2015, 8, 3);
// oneday.print();
//}
/*****************************************************
析构函数
******************************************************/
//#include<iostream>
//using namespace std;
//class person
//{
// char *pname;
//public:
// person(char*PN = "noname")
// {
// cout << "constructing " << PN << "\n";
// pname = new char[strlen(PN) + 1];
// if (pname)
// strcpy(pname, PN);
// }
// ~person()
// {
// cout << "destructing" << pname << "\n";
// delete pname;
// }
//};
//int main()
//{
// person p1("randy");
// return 0;
//}
/******************
验证usingnamespace位置
******************/
//
//#include<iostream>
//int main()
//{
// using namespace std;
// cout << "hello" << endl;
// return 0;
//}
/******************
自定义函数
******************/
//#include<iostream>
//using namespace std;
//void simon(int );
//int main()
//{
// simon(3);
// cout << "pick an integer:\n";
// int count;
// cin >> count;
// simon(count);
// cout << "Done!\n";
// return 0;
//}
//void simon(int n)
//{
// cout << "simon says touch your toes " << n << " times" << endl;
//}
/*2.7.3*/
//#include<iostream>
//using namespace std;
//void self_defining_function1(void);
//void self_defining_function2(void);
//int main()
//{
// self_defining_function1();
// self_defining_function1();
// self_defining_function2();
// self_defining_function2();
// return 0;
//}
//void self_defining_function1()
//{
// cout << "There blind mice\n";
//}
//void self_defining_function2()
//{
// cout << "See how there run\n";
//}
/*2.7.7*/
//#include<iostream>
//using namespace std;
//int main()
//{
// int x;
// int y;
// cout << "Enter the number of hours:";
// cin >> x;
// cout << "Enter the number of minutes:";
// cin >> y;
// cout << x << ":" << y << endl;
// return 0;
//}
/*C++打印进制*/
//#include<iostream>
//#include<climits>
//using namespace std;
//int main()
//{
// int chest = 42;
// int waist = 42;
// int inseam = 42;
// cout << hex;
// cout << waist;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// char ch = 'M';
// cout << 'M';
// cout.put(ch);
// return 0;
//}
/*验证换行符*/
//#include<iostream>
//using namespace std;
//int main()
//{
// cout << endl;
// cout << "\n";
// cout << '\n';
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// cout << "\aOperation\"HyperHype\"is now activated!\n";
// cout << "Enter your code:________\b\b\b\b\b\b\b\b";
// long code;
// cin >> code;
// cout << "\aCode verified! Proceed with Plan 23!\n";
// return 0;
//}
/*验证string类*/
//#include<iostream>
//#include<string>
//#include<cstring>
//using namespace std;
//int main()
//{
// char charr[20];//未初始化,结束随机
// string str;
// cout << "Length of string in charr before input:"
// << strlen(charr) << endl;
// cout << "Length of string in str before input:"
// << str.size() << endl;
// cout << "Enter a line of text:\n";
// cin.getline(charr, 20);
// cout << "you entered :" << charr << endl;
// cout << "enter another line of text :\n";
// getline(cin, str);
// cout << "Length of string in charr after input:"
// << strlen(charr) << endl;
// cout << "Length of string in str after input:"
// << str.size() << endl;
// return 0;
//}
/*在程序中使用结构*/
//#include<iostream>
//using namespace std;
//struct inflatable
//{
// char name[20];
// float volume;
// double price;
//};
//int main()
//{
// inflatable guest =
// {
// "Glorious Gloria",
// 1.88,
// 29.99
// };
// inflatable pal =
// { "Audacious Arthur",
// 3.12,
// 32.99
// };
// cout << "Expand your guest list with " << guest.name;
// cout << "and " << pal.name << "!\n";
// cout << "you can have both for $";
// cout << guest.price + pal.price << endl;
//return 0;
//}
//#include<iostream>
//using namespace std;
//const int FOOT_TO_INCH = 12;
//int main()
//{
// int nights = 1001;
// int *pt = new int;
// *pt = 1001;
// cout << "nights value= " << nights << ": location " << &nights << endl;
// return 0;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// double *p3 = new double[3];
// p3[0] = 0.2;
// p3[1] = 0.5;
// p3[2] = 0.8;
// cout << "p3[1] is " << p3[1] << endl;
// p3 = p3 + 1;
// cout << "now p3[0] is " << p3[0] << endl;
// cout << "p3[1] is " << p3[1] << endl;
// p3 = p3 - 1;
// delete[]p3;
// return 0;
//}
/*use different forms of strings */
//#include<iostream>
//#include<cstring>
//using namespace std;
//int main()
//{
// char animal[20] = "bear";
// const char *bird = "wren";
// char *ps;
// cout << animal << " and ";
// cout << bird << endl;
// cout << "Enter a kind of animal:";
// cin >> animal;
// ps = animal;
// cout << ps << endl;
// cout << "before using strcpy():\n";
// cout << animal << " at " << (int *)animal << endl;
// cout << ps << " at " << (int *)ps << endl;
// ps = new char[strlen(animal) + 1];
// strcpy(ps, animal);
// cout << "after using strcpy():\n";
// cout << animal << " at " << (int *)animal << endl;
// cout << ps << " at " << (int *)ps << endl;
// delete[]ps;
// return 0;
//}
/*the use of the structure pointer*/
//#include<iostream>
//struct inflatable
//{
// char name[20];
// float volume;
// double price;
//};
//using namespace std;
//int main()
//{
// inflatable *ps = new inflatable;
// cout << "Enter name of inflatable item :";
// cin.get(ps->name, 20);
// cout << "Enter volume in cubic feet :";
// cin >> (*ps).volume;
// cout << "Enter price: $";
// cin >> ps->price;
// cout << "name : " << (*ps).name << endl;
// cout << "volume:" << ps->volume << " cubic feet\n";
// cout << "price:$" << ps->price << endl;
// delete ps;
// return 0;
//}
/**/
//#include<iostream>
//#include<cstring>
//using namespace std;
//char * getname(void)
//{
// char temp[80];
// cout << "Enter last name: ";
// cin >> temp;
// char *pn = new char[strlen(temp) + 1];
// strcpy(pn, temp);
// return pn;
//}
//int main()
//{
// char * name;
// name = getname();
// cout << name << " at " << (int *)name << endl;
// delete[]name;
// name = getname();
// cout << name << " at " << (int *)name << endl;
// delete[]name;
// return 0;
//}
//#include<iostream>
//#include<vector>
//#include<array>
//using namespace std;
//int main()
//{
// double al[4] = { 1.2, 2.4, 3.6, 4.8 };
// array<double, 4>a3 = { 1, 2, 3, 4 };
// array<double, 4>a4;
// a4 = a3;
// cout << a4[2] << endl<< &a4[2] << endl;
// cout << a3[2] << endl << &a3[2] << endl;
// return 0;
//}
//#include<iostream>
//#include<string>
//using namespace std;
//struct CandyBar
//{
// char brand[20];
// float weight;
// unsigned int calorie;
//};
//int main()
//{
// CandyBar *pc = new CandyBar[3];
// strcpy(pc[0].brand, "Mocha Munch");
// pc[0].weight = 2.3;
// pc[0].calorie = 456;
// strcpy(pc[1].brand, "Hershery bar");
// pc[1].weight = 2.4;
// pc[1].calorie = 445;
// strcpy(pc[2].brand, "Musketeeres");
// pc[2].weight = 2.5;
// pc[2].calorie = 556;
// cout << "My 1st CandyBar is " << pc[0].brand << "." << endl;
// delete[]pc;
// return 0;
//}
//
//#include<iostream>
//using namespace std;
//int main()
//{
// int x = 100;
// cout.setf(ios_base::boolalpha);
// cout << (x < 3) << endl;
// return 0;
//}
//#include<iostream>
//#include<string>
//using namespace std;
//int main()
//{
// cout << "Enter a word>>" << endl;
// string word;
// cin >> word;
// char temp;
// int i, j;
// for (j = 0, i = word.size() - 1; j < i; --i, ++j)
// {
// temp = word[i];
// word[i] = word[j];
// word[j] = temp;
// }
// cout << word << "\nDone \n";
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// char word[5] = "?ate";
// for (char ch = 'a'; strcmp(word, "mate"); ch++)
// {
// cout << word << endl;
// word[0] = ch;
// }
// cout << "After loop ends,word is " << word << endl;
// return 0;
//}
//#include<iostream>
//#include<ctime>
//using namespace std;
//int main()
//{
// cout << "Enter the delay time\n";
// float secs;
// cin >> secs;
// clock_t delay = secs*CLOCKS_PER_SEC;
// cout << "starting\a\n";
// clock_t strat = clock();
// while (clock() - strat < delay)
// ;
// cout << "Done\a" << endl;
// return 0;
//}
//
//#include<iostream>
//using namespace std;
//int main()
//{
// double prices[5] = { 4.33, 2.3, 4.5, 6.7, 6.4 };
// for (double &x : prices)
// {
// x = x*0.8;
// cout << x << std::endl;
// }
// return 0;
//}
/*5.9.1*/
//#include<iostream>
//using namespace std;
//int main()
//{
// int sum = 0;
// int x, y;
// cin >> x;
// cin >> y;
// for (int i = x; i <= y; i++)
// {
// sum += i;
// }
// cout << sum << endl;
// return 0;
//}
/*5.9.2*/
//#include<iostream>
//#include<array>
//const int ArSize = 101;
//
//using namespace std;
//
//int main()
//{
// array<long double, ArSize>factorials;
// factorials[1] = factorials[0] = 1;
// for (int i = 2; i < ArSize; i++)
// {
// factorials[i] = i*factorials[i - 1];
// }
// for (int i = 0; i < ArSize; i++)
// {
// cout << i << "!=" << factorials[i] << endl;
// }
// return 0;
//}
/*5.9.3*/
//#include<iostream>
//using namespace std;
//int main()
//{
// int ch;
// int sum = 0;
// do
// {
// cin >> ch;
// sum += ch;
// } while (ch);
// cout << sum << endl;
// return 0;
//}
/*5.9.4*/
//#include<iostream>
//using namespace std;
//int main()
//{
// int n=0;
// int sum1 = 100;
// int sum2 = 100;
// while (sum2 >= sum1)
// {
// n++;
// sum1 = 100 + 10 * n;
// sum2 = sum2+sum2*0.5;
// }
// cout << n << endl;
// return 0;
//}
/*5.9.5*/
//#include<iostream>
//#include<string>
//using namespace std;
//int main()
//{
// int i = 0;
// const string Month[] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL",
// "AUG", "SEP", "OCT", "MOV", "DEC" };
// int sale_amount[12] = {};
// unsigned int sum = 0;
// for (i = 0; i < 12; i++)
// {
// cout << "Enter the sale amount of " << Month[i] << ":";
// cin >> sale_amount[i];
// }
// cout << "Input DONE!" << endl;
// for (i = 0; i < 12; i++)
// {
// cout<< Month[i] << "SALE :" << sale_amount[i] << endl;
// sum += sale_amount[i];
// }
// cout << "Total sale " << sum << "this year" << endl;
// return 0;
//}
/*5.9.5*/
//#include<iostream>
//#include<string>
//using namespace std;
//int main()
//{
// int i = 0;
// int j = 0;
// const string Month[] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL",
// "AUG", "SEP", "OCT", "MOV", "DEC" };
// int sale_amount[3][12] = {};
// unsigned int sum = 0;
// for (j = 0; j< 3; j++)
// {
// cout << "the " << j + 1 << " year" << endl;
// for (i = 0; i < 12; i++)
// {
// cout << "Enter the sale amount of " << Month[i] << ":";
// cin >> sale_amount[j][i];
// }
// }
// cout << "Input DONE!" << endl;
// for (j = 0; j < 3; j++)
// {
// for (i = 0; i < 12; i++)
// {
// cout << Month[i] << "SALE :" << sale_amount[i] << endl;
// sum += sale_amount[j][i];
// }
// }
// cout << "Total sale " << sum << "this year" << endl;
// return 0;
//}
/*5.9.7*/
//#include<iostream>
//#include<string>
//struct car
//{
// string maker[20];
// int date_year;
//};
//using namespace std;
//int main()
//{
// int n;
// int i;
// cout << "How many cars do you wish to catalog ?\n";
// cin >> n;
// for (i = 0; i < n; i++)
// {
// cout << "Car # " << i + 1 << endl;
// cout << "Please input the maker\n";
// cin >>car.maker[20];
// cout << "Please input the data_year\n";
// }
//}
//#include<iostream>
//using namespace std;
//
//int main()
//{
// int arry[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
//}
////#include<iostream>
////using namespace std;
////int regression_equation(int size,int x[], int y[],int new_student)
////{
//// int t1 = 0,t2 = 0, t3 = 0,t4 = 0;
//// double a = 0, b = 0;
//// int i = 0;
//// for (i = 0; i < size; i++)
//// {
//// t1 += x[i] * x[i];
//// t2 += x[i];
//// t3 += x[i] * y[i];
//// t4 += y[i];
//// }
//// b= (t3 - t2*t4 / size) / (t1 - t2*t2 / size);
//// a = t4 / size - b*t2 / size;
//// cout << "y=" << b << " * x + " << a << endl;
//// return (b*new_student + a);
////}
////int main()
////{
//// int student[10] = {2,6,8,8,12,16,20,20,22,26};
//// int profit[10] = {58,105,88,118,117,137,157,169,149,202};
//// int student_new=0;
//// cin >> student_new;
//// int profit_new=0;
//// profit_new=regression_equation(10.0,student,profit,student_new);
//// cout << profit_new << endl;
//// return 0;
////}
//#include<iostream>
//using namespace std;
//unsigned int c_in_str(const char *str, char ch);
//int main()
//{
// char mmm[15] = "minium";
// char *wail = "ululate";
// unsigned int ms = c_in_str(mmm, 'm');
//}
//#include<iostream>
//#include<cmath>
//using namespace std;
//struct polar
//{
// double distance;
// double angle;
//};
//struct rect
//{
// double x;
// double y;
//};
//polar rect_to_polar(rect xypos)
//{
// polar answer;
//
// answer.distance = sqrt(xypos.x*xypos.x + xypos.y*xypos.y);
// answer.angle = atan2(xypos.y, xypos.x);
// return answer;
//}
//void show_polar(polar dapos)
//{
// const double Rad_to_deg = 57.29577951;
// cout << "angle= " << dapos.angle*Rad_to_deg;
// cout << "degrees\n";
//}
//int main()
//{
// rect rplace;
// polar pplace;
// cout << "Enter the x and y values:";
// while (cin >> rplace.x>>rplace.y)
// {
// pplace = rect_to_polar(rplace);
// show_polar(pplace);
// cout << "Next two numbers (q to quit):";
// }
// cout << "Done .\n";
// return 0;
//}
//#include<iostream>
//#include<cmath>
//using namespace std;
//struct polar
//{
// double distance;
// double angle;
//};
//struct rect
//{
// double x;
// double y;
//};
//void rect_to_polar(const rect *pxy, polar *pda)
//{
// pda->distance = sqrt(pxy->x*pxy->x + pxy->y*pxy->y);
// pda->angle = atan2(pxy->y, pxy->x);
//}
//void show_polar(const polar*pa)
//{
// const double Rad_to_deg = 57.29577951;
// cout << "Distance = " << pa->distance;
// cout << " angle = " << pa->angle*Rad_to_deg;
// cout << "degree\n";
//}
//int main()
//{
// rect rplace;
// polar pplace;
// cout << "Enter the x and y value :";
// while (cin >> rplace.x >> rplace.y)
// {
// rect_to_polar(&rplace, &pplace);
// show_polar(&pplace);
// cout << "Next two numbers (q to quit):\n";
// }
// cout << "Done>>\n";
// return 0;
//}
//#include<iostream>
//#include<string>
//const int SIZE = 5;
//using namespace std;
//void display(const string sa[], int n)
//{
// for (int i = 0; i < n; i++)
// {
// cout << i + 1 << " : " << sa[i] << endl;
// }
//}
//int main()
//{
// string list[SIZE];
// cout << "Enter your " << SIZE << "favorite astronomical sights :\n";
// for (int i = 0; i < SIZE; i++)
// {
// cout << i + 1 << ":";
// getline(cin, list[i]);
// }
// cout << "Your list :\n";
// display(list, SIZE);
// return 0;
//}
//#include<iostream>
//#include<array>
//#include<string>
//const int Seasons = 4;
//using namespace std;
//const array<string, Seasons>Snames = { "Spring", "summer", "Fall", "Winter" };
//void fill(array<double, Seasons>*pa);
//void show(array<double, Seasons>da);
//int main()
//{
// array<double, Seasons>expense;
// fill(&expense);
// show(expense);
// return 0;
//}
//void fill(array<double, Seasons>*pa)
//{
// for (int i = 0; i < Seasons; i++)
// {
// cout << "Enter " << Snames[i] << " expense:";
// cin >> (*pa)[i];
// }
//}
//void show(array<double, Seasons>da)
//{
// double total = 0.0;
// cout << "\nEXPENSE\N";
// for (int i = 0; i < Seasons; i++)
// {
// cout << Snames[i] << ": $ " << da[i] << endl;
// total += da[i];
// }
// cout << "Total Expense : $" << total << endl;
//}
//#include<iostream>
//#include<string>
//#include<ctype.h>
//const int SIZE = 1000;
//using namespace std;
//int main()
//{
// char strr[SIZE];
// char word[26];
// char str[SIZE];
// int i = 0, m = 0;
// int count[SIZE] = {0};
// cout << "Please enter a string of characters>>" << endl;
// cin.getline(strr, SIZE);
// for (int k = 0; k < strlen(strr); k++)
// {
// if (isalpha(strr[k]))
// {
// if (isupper(strr[k]))
// {
// strr[k] = strr[k] + 32;
// }
// str[m] = strr[k];
// m++;
// }
// else
// break;
// str[m] = '\0';
// }
// for ( i = 0; i < 26; i++)
// {
// int count1 = 0;
// word[i] = i + 97;
// for (int j = 0; j < strlen(str); j++)
// {
// if (word[i] == str[j])
// {
// ++count1;
// count[i] = count1;
// }
// }
// if (count[i] >= 1)
// {
// cout << word[i] << " " << count[i] << endl;
// }
// }
//
// return 0;
//}
////no function
//#include<iostream>
//using namespace std;
//int main()
//{
// int factorial = 1;
// int arry[3] = { 4, 6, 8 };
// for (int i = 0; i < 3; i++)
// {
// for (int j = arry[i]; j>0; j--)
// {
// factorial *= j;
// }
// cout << arry[i] << "!=" << factorial << endl;
// factorial = 1;
// }
// return 0;
//}
//with the function
//#include<iostream>
//using namespace std;
//int Factorial(int n)
//{
// int factorial = 1;
// for (int i = n; i > 0; i--)
// {
// factorial *= i;
// }
// return factorial;
//}
//int main()
//{
// int factorial = 1;
// int arry[3] = { 4, 6, 8 };
// for (int i = 0; i < 3; i++)
// {
// cout <<arry[i]<<"!="<< Factorial(arry[i]) << endl;
// }
// return 0;
//}
//#include<iostream>
//using namespace std;
//const int Len = 66;
//const int Divs = 6;
//void subdivide(char ar[], int low, int high, int level)
//{
// if (level == 0)
// return;
// int mid = (high + low) / 2;
// ar[mid] = '|';
// subdivide(ar, low, mid, level - 1);
// subdivide(ar, mid, high, level - 1);
//}
//int main()
//{
// char ruler[Len];
// int i;
// for (i = 0; i < Len - 2; i++)
// ruler[i] = ' ';
// ruler[Len - 1] = '\0';
// int max = Len - 2;
// int min = 0;
// ruler[min] = ruler[max] = '|';
// cout << ruler << endl;
// for (i = 0; i <= Divs; i++)
// {
// subdivide(ruler, min, max,i);
// cout << ruler << endl;
// for (int j = 1; j < Len - 2; j++)
// ruler[j] = ' ';
// }
// return 0;
//}
//#include<iostream>
//using namespace std;
//inline double square(double x)
//{
// return x*x;
//}
//int main()
//{
// double a, b;
// double c = 13.0;
//
// a = square(5.0);
// b = square(4.5 + 7.5);
// cout << "a=" << a << " ,b=" << b << endl;
// cout << "c=" << c;
// cout << ",c squared=" << square(c++) << endl;
// cout << "now c=" << c << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//double cube(double a);
//double refcube(double &ra);
//int main()
//{
// double x = 3.0;
// cout << cube(x);
// cout << "=cube of " << x << endl;
// cout << refcube(x);
// cout << "=refcube of " << x << endl;
// return 0;
//}
//double cube(double a)
//{
// a *= a*a;
// return a;
//}
//double refcube(double &ra)
//{
// ra *= ra*ra;
// return ra;
//}
//#include<iostream>
//using namespace std;
//const int ArSize = 80;
//char *left(const char *str, int n = 1);
//int main()
//{
// char sample[ArSize];
// cout << "Enter a string \n";
// cin.get(sample, ArSize);
// char *ps = left(sample, 4);
// cout << ps << endl;
// delete[]ps;
// ps = left(sample);
// cout << ps << endl;
// delete[]ps;
// return 0;
//}
//char *left(const char *str, int n)
//{
// if (n < 0)
// n = 0;
// char *p = new char[n + 1];
// int i;
// for (i = 0; i < n&&str[i]; i++)
// p[i] = str[i];
// while (i <= n)
// p[i++] = '\0';
// return p;
//}
#/*include<iostream>
using namespace std;
template<typename T>
void Swap(T &a, T &b);
int main()
{
int i = 10, j = 20;
cout << "i,j=" << i << "," << j << endl;
cout << "Using compiler-generated int swapper:\n";
Swap(i, j);
cout << "Now i,j=" << i << "," << j << endl;
double x = 24.5, y = 81.7;
cout << "x,y=" << x << "," << y << endl;
cout << "Using complier-generated double swapper:\n";
Swap(x, y);
cout << "Now x,y=" << x << "," << y << endl;
return 0;
}
template<typename T>
void Swap(T &a, T &b)
{
T temp;
temp = a;
a = b;
b = temp;
}*/
//#include<iostream>
//using namespace std;
//template<typename T>
//void Swap(T &a, T &b);
//
//struct job
//{
// char name[40];
// double salary;
// int floor;
//};
//template<>void Swap<job>(job &j1, job &j2);
//void show(job &j);
//int main()
//{
// using namespace std;
// cout.precision(2);
// cout.setf(ios::fixed, ios::floatfield);
// int i = 10, j = 20;
// cout << "i,j=" << i << "," << j << endl;
// cout << "Using compiler-generated int swapper:\n";
// Swap(i, j);
// cout << "Now i,j=" << i << "," << j << endl;
//
//
// job sue = { "Susan Yaffee", 7300.60, 7 };
// job sindey = { "Sideny Taffee", 78060.72, 9 };
// cout << "Before job swapping :\n";
// show(sue);
// show(sindey);
// Swap(sue, sindey);
// cout << "After job swapping :\n";
// show(sue);
// show(sindey);
// return 0;
//}
//template<typename T>
//void Swap(T &a, T &b)
//{
// T temp;
// temp = a;
// a = b;
// b = temp;
//}
//template<>void Swap<job>(job &j1, job &j2)
//{
// double t1;
// int t2;
// t1 = j1.salary;
// j1.salary = j2.salary;
// j2.salary = t1;
// t2 = j1.floor;
// j1.floor = j2.floor;
// j2.floor = t2;
//}
//void show(job &j)
//{
// cout << j.name << ":$" << j.salary << "on floor" << j.floor << endl;
//}
//#include<iostream>
//#include<string>
//using namespace std;
//int main()
//{
// /*cout << sizeof("\thow do you do?\0i am student.") << endl;
// cout << strlen("\thow do you do?\0i am student.");*/
//
// cout << sizeof("abcdef\0wer")<<endl;
// cout << sizeof("abcdef\0wery")<<endl;
// cout << strlen("abcdef\0wer") << endl;
// cout << strlen("abcdef\0wer\0") << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Point
//{
// int x, y;
//public:
// void set(int m, int n)
// {
// x = m;
// y = n;
// }
// void print()const
// {
// cout << "(" << x << " ," << y << ")\n";
// }
// friend Point operator+(const Point &a, const Point &b);
// friend Point add(const Point &a, const Point &b);
//};
//Point operator+(const Point &a, const Point &b)
//{
// Point s;
// s.set(a.x + b.x, a.y + b.y);
// //s.print();
// return s;
//}
//Point add(const Point &a, const Point &b)
//{
// Point s;
// s.set(a.x + b.x, a.y + b.y);
// //s.print();
// return s;
//}
//int main()
//{
// Point a, b;
// a.set(3, 2);
// b.set(1, 5);
// (a + b).print();
// operator+(a, b).print();
// add(a,b).print();
// return 0;
//}
//#include<iostream>
//#include<cmath>
//using namespace std;
//int main()
//{
// double a = 1E-3;
// cout << a << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// char ch;
// cin >> ch;
// if (ch >= 65&&ch <= 90)
// cout << "yes\n";
// else
// cout << "no\n";
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// int arr[5];
// int i = 0;
// int m, n;
// int t;
// for (i = 0; i < 5; i++)
// {
// cin >> arr[i];
// }
// int max =arr[0];
// int min = arr[0];
// for (i = 1; i < 5; i++)
// {
// if (arr[i]>max)
// {
// max = arr[i];
// }
// }
// for (i = 0; i < 5; i++)
// {
// if (max == arr[i])
// {
// cout << "number : " << i << endl;
// m = i;
// }
// }
// for (i = 1; i < 5; i++)
// {
// if (arr[i]<min)
// {
// min = arr[i];
// }
// }
// for (i = 0; i < 5; i++)
// {
// if (min == arr[i])
// {
// cout << "number : " << i << endl;
// n = i;
// }
// }
// cout << "After swap\n";
// t = arr[m];
// arr[m] = arr[n];
// arr[n] = t;
// for (i = 0; i < 5; i++)
// {
// cout << arr[i] << " ";
// }
// cout << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//double ave(double a[])
//{
// int sum = 0;
// int length = sizeof(a) / sizeof(a[0]);
// for (int i = 0; i < length; i++)
// sum += a[i];
// return sum / length;
//}
//int main()
//{
// int i = 0;
// double a[80];
// cout << "input a[]" << endl;
// while (cin >> a[i])
// {
// i++;
// }
// cout << "average is" << ave(a);
// return 0;
//}
//#include<iostream>
//#include<iomanip>
//using namespace std;
//int ave(int a[100])
//{
// int sum = 0;
// int length = sizeof(a) / sizeof(a[0]);
// for (int i = 0; i < length; i++)
// sum += a[i];
// return sum / length;
//}
//int main()
//{
// int a[100];
// int i = 0;
// while ((cin>>a[i])!=EOF)
// {
// i++;
// }
// cout << ave(a) << endl;;
// return 0;
//}
//#include <iostream>
//#include <vector>
//using namespace std;
//
//int main()
//{
// int sum = 0, value = 0;
// vector<int>test;
// //实际上非数字就会结束循环
// cout << "以*号作为结束;";
// while (cin >> value)
// test.push_back(value);
// vector<int>::iterator it;
// for (it = test.begin(); it != test.end(); it++)
// cout << *it << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int ave(int a[100])
//{
// int sum = 0;
// int length = sizeof(a) / sizeof(a[0]);
// for (int i = 0; i < length; i++)
// sum += a[i];
// return (sum / length);
//}
//int main()
//{
// int a[5];
// int i = 0;
// a[i] = 0;
// while (i<5&&cin>>a[i])
// {
// i++;
// }
// a[i] = '\0';
// cout << ave(a) << endl;
// return 0;
//}
//#include <iostream>
//#include <iomanip>
//using namespace std;
//const double p = 3.14;
//int main()
//{
// float r, h;
// float s, area;
// cout << "输入半径和高:" << endl;
// //start
// cin >> r >> h;
// area = (1/ 3.0) * p * r * r * h;
// //end
// cout << setiosflags(ios::fixed);
// cout << setprecision(2);
// cout << "area=" << area << endl;
// return 0;
//}
//计算Π的近似值
//#include<iostream>
//#include<cmath>
//#include<iomanip>
//using namespace std;
//int main()
//{
// int n = 0;
// double m,pi=2;
// do
// {
// n++;
// m = 4 *n*n / (4 * n*n - 1);
// pi = fabs(pi*m);
// } while ();
// cout.setf(ios::fixed, ios::floatfield);
// cout << "Π的值为" << setprecision(4) << pi << ",n的值为:" <<n<< endl;
// return 0;
//}
//
//#include<iostream>
//using namespace std;
//int main()
//{
// double pi = 1.0, l;
// int i;
// for (i = 1; (2 * i)*(2 * i)*1.0 / ((2 * i - 1)*(2 * i + 1)) > 1E-3; i++)
// {
// l = (2 * i)*(2 * i)*1.0/ ((2 * i - 1)*(2 * i + 1));
// pi *= l*;
// }
// cout << 2 * pi << " " << i << endl;
// return 0;
//}
//计算Π的近似值
//#include<iostream>
//#include<cmath>
//#include<iomanip>
//using namespace std;
//int main()
//{
// int n = 281, i, j;
// float pi = 2.0;
// for (i = 1, j = 2; i < 2 * n + 1; i += 2, j += 2)
// pi = pi * (pow(j, 2)) / (i * (i + 2));
// cout.setf(ios::fixed, ios::floatfield);
// cout << "Π的值为" << setprecision(4) << pi << ",n的值为:281" << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Time
//{
// int h;
// int m;
// int s;
// int s_past;
//public:
// void set(int a, int b, int c,int d)
// {
// a = h;
// b = m;
// c = s;
// d = s_past;
// }
//};
//int main()
//{
// int a, b, c, d;
// cin >> a >> b >> c;
// cin >> d;
//
//}
//#include <iostream>
//using namespace std;
//class Time
//{
// int hour;
// int minute;
// int second;
//public:
// void init(int h, int m, int s)
// {
// hour = h;
// minute = m;
// second = s;
// }
// void add(int num)
// {
// second = second + num;
// if (second >= 60)
// {
// minute += second / 60;
// second = second % 60;
// }
//
// if (minute >= 60)
// {
// hour += minute / 60;
// minute = minute % 60;
// }
// if (hour >= 24)
// {
// hour = hour % 24;
// }
// }
// void print()
// {
// cout << hour << " " << minute << " " << second;
// }
//};
//int main()
//{
// int h, m, s;
// cin >> h >> m >> s;
// int num;
// cin >> num;
// Time time;
// time.init(h, m, s);
// time.add(num);
// time.print();
//
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Time
//{
// int hour;
// int minute;
// int second;
//public:
// void set(int a, int b, int c)
// {
// hour = a;
// minute = b;
// second = c;
// }
// int get_seconds()
// {
// int num = (59 - second) + (59 - minute) * 60 + (23 - hour) * 3600;
// return num;
// }
//};
//int main()
//{
// Time time_one, time_two;
// int h1, m1, s1;
// cin >> h1 >> m1 >> s1;
// int h2, m2, s2;
// cin >> h2 >> m2 >> s2;
// time_one.set(h1, m1, s1);
// time_two.set(h2, m2, s2);
// cout<< (time_one.get_seconds() - time_two.get_seconds());
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Date
//{
// int year;
// int month;
// int day;
//public:
// void set(int a, int b, int c);
// void is_leap(int m);
// void after_add(int n);
// void print();
//};
//void Date::set(int a, int b, int c)
//{
// year = a;
// month = b;
// day = c;
//}
//bool is_leap(int m)
//{
// if (m % 4 == 0 && m % 100 != 0 || m % 400 == 0)
// return true;
// else
// return false;
//}
//void Date::after_add(int n)
//{
// day = day + n;
//}
//int main()
//{
// int year, month, day;
// cin >> year >> month >> day;
// int a[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
// if (is_leap(year) == true) a[2] = 29;
// int x;
// cin >> x;
// while (x != 0)
// {
// day++;
// if (day>a[month])
// {
// day = 1;
// month++;
// }
// if (month>12)
// {
// month = 1;
// year++;
// if (is_leap(year) == true)
// a[2] = 29;
// else a[2] = 28;
// }
// x--;
// }
// cout << year << " " << month << " " << day;
// return 0;
//}
//#include<iostream>
//using namespace std;
//bool is_leap(int m)
//{
// if (m % 4 == 0 && m % 100 != 0 || m % 400 == 0)
// return true;
// else
// return false;
//}
//class Date
//{
// int year;
// int month;
// int day;
//public:
// void set(int a, int b, int c)
// {
// year = a;
// month = b;
// day = c;
// }
// int day_follow(int y1,int m1,int d1,int y2,int m2,int d2)
// {
// int a[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
// int i;
// int sum = 0;
// int total = 0;
// if (y1 != y2)
// {
// if (is_leap(y1) == true)
// {
// a[2] = 29;
// for (i = 0; i < m1; i++)
// {
// total += a[i];
// }
// sum += (366 - total);
// }
// else
// {
// for (i = 0; i < m1; i++)
// {
// total += a[i];
// }
// sum += (365 - total);
// }
// for (i = y1 + 1; i < y2; i++)
// {
// if (is_leap(i) == true)
// {
// sum += 366;
// }
// else
// sum += 355;
// }
// if (is_leap(y2) == true)
// {
// a[2] = 29;
// for (i = 0; i < m2; i++)
// {
// sum += a[i];
// }
// }
// }
// if (y1 == y2)
// {
// for (i = m1; i < m2; i++)
// {
// sum += a[i];
// }
// }
// sum = sum + d2 - d1;
// }
//};
//
//int main()
//{
// int a[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
// int y1, m1, d1;
// cin >> y1 >> m1 >> d1;
// int y2, m2, d2;
// cin >> y2 >> m2 >> d2;
// Date t_1, t_2;
// t_1.set(y1, m1, d1);
// t_2.set(y2, m2, d2);
// cout <<day_follow(y1, m1, d1, y2, m2, d2) << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//
//bool is_leap(int m)
//{
// if ((m % 4 == 0 && m % 100 != 0 )|| (m % 400 == 0))
// return true;
// else
// return false;
//}
//int main()
//{
// int a[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
// int y1, m1, d1;
// cin >> y1 >> m1 >> d1;
// int y2, m2, d2;
// cin >> y2 >> m2 >> d2;
// int i;
// int sum = 0;
// int total = 0;
// if (y1 != y2)
// {
// if (is_leap(y1) == true)
// {
// a[2] = 29;
// for (i = 0; i < m1; i++)
// {
// total += a[i];
// }
// sum += (366 - total);
// }
// else
// {
// for (i = 0; i < m1; i++)
// {
// total += a[i];
// }
// sum += (365 - total);
// }
// for (i = y1 + 1; i < y2; i++)
// {
// if (is_leap(i) == true)
// {
// sum += 366;
// }
// else
// sum += 355;
// }
// if (is_leap(y2) == true)
// {
// a[2] = 29;
// for (i = 0; i < m2; i++)
// {
// sum += a[i];
// }
// }
// }
// if (y1 == y2)
// {
// for (i = m1; i < m2; i++)
// {
// sum += a[i];
// }
// }
// sum = sum + d2 - d1;
// cout << sum << endl;
// return 0;
//}
//#include <iostream>
//using namespace std;
//
//int isLeap(int year);
//int MonthDay(int year, int month);
//int GoDays(int year, int month, int day);
//
//int main()
//{
// int year1, month1, day1;
// int year2, month2, day2;
// cin>> year1 >> month1 >> day1;
// cin >> year2 >> month2 >> day2;
// int sum = GoDays(year2, month2, day2);
// for (int y = year1; y<year2; y++)
// sum = sum + 365 + isLeap(y);
// sum = sum - GoDays(year1, month1, day1);
// cout << sum << endl; // 4600
// return 0;
//}
//
//int isLeap(int year) // 返回值1,是; 返回值0,不是。
//{
// int r4 = year % 4;
// int r100 = year % 100;
// int r400 = year % 400;
// if (r400 == 0 || (r4 == 0 && r100 != 0))
// return 1; // 1600 2000 1988 2020
// else
// return 0; // 2021 2022 2023
//}
//
//int MonthDay(int year, int month)
//{
// int leap = isLeap(year);
// int day = 31;
// if (month == 4 || month == 6 || month == 9 || month == 11)
// day = 30;
// else
// if (month == 2)
// day = 28 + leap;
// return day;
//}
//
//int GoDays(int year, int month, int day)
//{
// int sum = day;
// for (int m = 1; m<month; m++)
// sum = sum + MonthDay(year, m);
// return sum;
//}
//#include <iostream>
//#include <vector>
//using namespace std;
//int main()
//{
// int sum = 0, value = 0;
// int n = 0;
// int b[100];
// vector<int>test;
// cout << "以*号作为结束;";
// while (cin >> value)
// test.push_back(value);
// vector<int>::iterator it;
// for (it = test.begin(); it != test.end(); it++)
// {
// b[n++] = *it;
// cout << *it << " ";
// }
// b[n] = '\0';
// cout << endl;
// cout <<n<< endl;
// for (int i = 0; i < n; i++)
// {
// sum += b[i];
// }
// cout << sum / n << endl;
// cout << endl;
// return 0;
//}
//
//#include<iostream>
//#include<vector>
//#include<string.h>
//using namespace std;
//
//int main()
//{
//
// vector<string> strs;
// string s;
// while (cin >> s)
// {
// strs.push_back(s);
// }
// cout << strs.size();
// return 0;
//}
/*给定一个N*M方格的迷宫,迷宫里有T处障碍,障碍处不可通过。给定起点坐标和终点坐标,
问: 每个方格最多经过1次,有多少种从起点坐标到终点坐标的方案。
在迷宫中移动有上下左右四种方式,每次只能移动一个方格。数据保证起点上没有障碍。*/
//#define _CRT_SECURE_NO_WARNINGS 1
//
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//using namespace std;
//int sx[8] = { 0, 0, 1, 1, 1, -1, -1, -1 };//八个方向,初始化赋好值
//int sy[8] = { 1, -1, 0, 1, -1, 0, 1, -1 };
//int n, i, j, ans = 0;
//int a[100][100], b[100][100];
//
//void dfs(int s, int t)
//{
// int i, x, y;
// if (s == 1 && t == n)//如果到达终点,方案数+1
// {
// ans++;
// return;
// }
// for (i = 0; i<8; ++i)//枚举八个方向
// {
// x = s + sx[i];
// y = t + sy[i];
// if (x>0 && y>0 && x <= n&&y <= n&&a[x][y] == 0 && b[x][y] == 0)//前四个条件是判断是否越界,最后一个是判断是否访问
// { //过
// b[x][y] = 1;
// dfs(x, y);
// b[x][y] = 0;
// }
// }
// return;
//}
//
//int main()
//{
// scanf_s("%d", &n);
// for (i = 1; i <= n; ++i)
// for (j = 1; j <= n; ++j)
// scanf_s("%d", &a[i][j]);
// b[1][1] = 1;//b[i][j]表示坐标为(i,j)这个点有没有被访问过
// dfs(1, 1);
// printf("%d", ans);
// return 0;
//}
//20210513 comn on
//#include <iostream>
//using namespace std;
//#define CLASS 3
//#define STU 4
//int FindMax(int score[CLASS][STU], int m, int *pRow, int *pCol);
//int main()
//{
// int score[CLASS][STU], i, j, maxScore, row, col;
// cout << "Please enter score:" << endl;
// for (i = 0; i < CLASS; i++)
// {
// for (j = 0; j < STU; j++)
// {
// cin >> score[i][j];
// }
// }
// maxScore = FindMax(score, CLASS, &row, &col);
// cout << "maxScore = " << maxScore << ", class= " << row + 1 << ", number = " << col + 1 << endl;
// return 0;
//}
//int FindMax(int score[][STU], int m, int* pRow, int* pCol)
//{
// int i, j, maxScore;
// maxScore = score[0][0];
// for (i = 0; i < m; i++)
// {
// for (j = 0; j < STU; j++)
// {
// if (score[i][j] > maxScore)
// {
// maxScore = score[i][j];
// *pRow = i;
// *pCol = j;
// }
// }
// }
// return(maxScore);
//}
//#include<iostream>
//#include<string>
//using namespace std;
//class studentID
//{
// int value;
//public:
// studentID(int id = 0)
// {
// value = id;
// cout << "Assigning student id " << value << "\n";
// }
//};
//class student
//{
// string name;
// studentID id;
//public:
// student(string n = "noName", int ssID = 0)
// {
// cout << "Constructing student " + n + "\n";
// name = n;
// studentID id(ssID);
// }
//};
//int main()
//{
// student s("Randy", 58);
// return 0;
//}
//#include<iostream>
//#include<string>
//using namespace std;
//class studentID
//{
// int value;
//public:
// studentID(int id = 0)
// {
// value = id;
// cout << "Assigning student id " << value << "\n";
// }
//};
//class student
//{
// string name;
// studentID id;
//public:
// student(string n = "noName", int ssID = 0)
// :id(ssID), name(n)//正规的大气的写法
// {
// cout << "Constructing student " <<n<<"\n";
// }
//};
//int main()
//{
// student s("Randy", 58);
// student("jerry");
// return 0;
//}
//#include<iostream>
//using namespace std;
//class A
//{
//public:
// A()
// {
// cout << "A->";
// }
//};
//class B
//{
//public:
// B()
// {
// cout << "B->";
// }
//};
//class C
//{
//public:
// C()
// {
// cout << "C->";
// }
//};
//void fuc()
//{
// cout << "\nfunc";
// A a;
// static B b;
// C c;
//}
//int main()
//{
// cout << "main : ";
// for (int i = 1; i <= 2; i++)
// {
// for (int j = 1; j <= 2;++j)
// if (i == 2)
// C c;
// else
// A a;
// B b;
// }
// fuc();
// fuc();
//}
//#define _CRT_SECURE_NO_WARNINGS 1
//
//#include<iostream>
//#include<string>
//using namespace std;
//class Person
//{
// char *pName;
//public:
// Person(char *pN = "noName")
// {
// cout << "Constructing " << pN << "\n";
// pName = new char[strlen(pN) + 1];
// if (pName)
// strcpy(pName, pN);
// }
// ~Person()
// {
// cout << "Destructing " << pName << "\n";
// delete[]pName;
// }
//};
//int main()
//{
// Person p1("Randy");
// Person p2;
// return 0;
//}
//#include<iostream>
//#include<string>
//using namespace std;
//class Person
//{
// char *pName;
//public:
// Person(char *pN = "noName")
// {
// cout << "Constructing " << pN << "\n";
// pName = new char[strlen(pN) + 1];
// if (pName)
// strcpy(pName, pN);
// }
// ~Person()
// {
// cout << "Destructing " << pName << "\n";
// delete[]pName;
// }
//};
//int main()
//{
// Person p1("Randy");
// Person p2(p1);
// return 0;
//}
//#define _CRT_SECURE_NO_WARNINGS 1
////#include<iostream>
////#include<string>
////using namespace std;
////class Person
////{
//// char *pName;
////public:
//// Person(char *pN = "noName")
//// {
//// cout << "Constructing " << pN << "\n";
//// pName = new char[strlen(pN) + 1];
//// if (pName)
//// strcpy(pName, pN);
//// }
//// Person(const Person &s)
//// {
//// cout << "Copy constructing " << s.pName << "\n";
//// pName = new char[strlen(s.pName) + 1];
//// if (pName)
//// strcpy(pName, s.pName);
//// }
//// ~Person()
//// {
//// cout << "Destructing " << pName << "\n";
//// delete[]pName;
//// }
////};
////int main()
////{
//// Person p1("Randy");
//// Person p2(p1);
//// return 0;
////}
//#include<iostream>
//using namespace std;
//class A
//{
//public:
// A()
// {
// cout << "A->";
// }
// ~A()
// {
// cout << "<-~A";
// }
//};
//class B
//{
//public:
// B()
// {
// cout << "B->";
// }
// ~B()
// {
// cout << "<-~B";
// }
//};
//class C
//{
//public:
// C()
// {
// cout << "C->";
// }
// ~C()
// {
// cout << "<-~C";
// }
//};
//void func()
//{
// cout << "\nfunc : ";
// A a;
// cout << "ok->";
// static B b;
// C c;
//}
//int main()
//{
// cout << "main : ";
// for (int i = 1; i <= 2; ++i)
// {
// for (int j = 1; j <= 2;++j)
// if (i == 2)
// C c;
// else
// A a;
// B b;
// }
// func();
// func();
// return 0;
//}
#define _CRT_SECURE_NO_WARNINGS 1
//#include<iostream>
//#include<string>
//using namespace std;
//class Student
//{
// string name;
//public:
// Student(const string &s) :name(s){}
//};
//void fn(Student &s)
//{
// cout << "ok\n";
//}
//int main()
//{
// fn(Student("Jenny"));
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Person
//{
// char *pName;
//public:
// Person(char *pN = "noName")
// {
// cout << "Constructing " << pN << "\n";
// pName = new char[strlen(pN) + 1];
// if (pName)
// strcpy(pName, pN);
// }
// Person(const Person &s)
// {
// cout << "copy Constructing " << s.pName << "\n";
// pName = new char[strlen(s.pName) + 1];
// if (pName)
// strcpy(pName, s.pName);
// }
// Person &operator=(Person &s)
// {
// cout << "Assigning " << s.pName << "\n";
// if (this == &s)
// return s;
// delete[]pName;
// pName = new char[strlen(s.pName) + 1];
// if (pName)
// strcpy(pName, s.pName);
// return *this;
// }
// ~Person()
// {
// cout << "Destructing " << pName << "\n";
// delete[]pName;
// }
//};
//int main()
//{
// Person p1("Randy");
// Person p2("Jenny");
// p2 = p1;
//}
//#include<iostream>
//using namespace std;
//class DateTime
//{
// int year;
// int month;
// int day;
// int hour;
// int minute;
// int second;
//public:
// DateTime(int a, int b, int c, int d, int e, int f)
// :year(a), month(b), day(c), hour(d), minute(e), second(f)
// {}
// int isLeapYear()
// {
// if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
// return 1;
// else
// return 0;
// }
// void add(int num)
// {
// second = second + num;
// if (second >= 60)
// {
// minute += second / 60;
// second = second % 60;
// }
//
// if (minute >= 60)
// {
// hour += minute / 60;
// minute = minute % 60;
// }
// if (hour >= 24)
// {
// day += hour / 24;
// hour = hour % 24;
// }
// int Month[13] = { 0, 31, 28 + isLeapYear(), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
// while (day > Month[month])
// {
// day -= Month[month];
// month++;
// if (month > 12)
// {
// month -= 12;
// year++;
// Month[2] = 28 + isLeapYear();
// }
// }
// }
// void print()
// {
// cout << year<<" " << month <<" "<< day<<" " << hour <<" "<< minute<<" " << second<<" " << endl;
// }
//};
//
//int main()
//{
// int year, month, day, hour, minute, second;
// cin >> year >> month >> day >> hour >> minute >> second;
// int second_add;
// cin >> second_add;
// DateTime s(year, month, day, hour, minute, second);
// s.add(second_add);
// s.print();
// return 0;
//}
//
//#include<iostream>
//using namespace std;
//class DateTime
//{
// int year;
// int month;
// int day;
// int hour;
// int minute;
// int second;
//public:
// DateTime(int a, int b, int c, int d, int e, int f)
// :year(a), month(b), day(c), hour(d), minute(e), second(f) {}
// int isLeapYear()
// {
// if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
// return 1;
// else
// return 0;
// }
// int get_second()
// {
// int total_second = 0;
// int total_day = 0;
// isLeapYear();
// int Month[13] = { 0, 31, 28 + isLeapYear(), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
// for (int i = 0; i < month; i++)
// {
// total_day += Month[i];
// }
// total_second = second + minute * 60 + hour * 3600 + (total_day+day) * 3600 * 24;
// return total_second;
// }
//};
//int main()
//{
// int year1, month1, day1, hour1, minute1, second1;
// int year2, month2, day2, hour2, minute2, second2;
// cin >>year1>>month1>>day1>>hour1>> minute1>>second1;
// cin >>year2>>month2>>day2>>hour2>> minute2>>second2;
// DateTime T1(year1, month1, day1, hour1, minute1, second1);
// DateTime T2(year2, month2, day2, hour2, minute2, second2);
// cout<<T2.get_second() - T1.get_second()<<endl;
// return 0;
//}
/*小华自从上大学后发现班级活动明显变多了,这天他们又准备去外面玩了,班长叫小华选出一些人在活动上表演节目,
以下是小华选人的策略:
把班级中的n个人,编号为1~n。由班长从1开始数数。班长数1,所有人都蹲下。数2,先看2是不是素数,如果是,那么
是这个数倍数的人改变动作(站着的话蹲下,蹲着的话站起来), 其他人保持不动。如果2不是素数,所有人的不动。
然后数3, 看3是不是素数......直到班长数到k.最后就让站着的同学为大家表演。
输入
两个整数,n和k。k≤100000。n≤100000
输出
站着的人的编号, 中间用空格隔开。*/
//#include<iostream>
//using namespace std;
//int is_prime(int n)
//{
// for (int i = 2; i < n; i++)
// {
// if (n%i == 0)
// {
// return 0;
// break;
// }
// }
// return 1;
//}
//int main()
//{
// int number_class;
// int k;
// int t;
// int a[100000];
// for (int x = 0; x < 100000; x++)
// {
// a[x] = 1;
// }
// cin >> number_class>>k;
// for (int i = 2; i <= k; i++)
// {
// if (is_prime(i))
// {
// for (int j = 1; j <= number_class; j++)
// {
// if (0==j%i)
// {
// t = -a[j];
// a[j] = t;
// }
// }
// }
// }
// for (int l = 1; l <= number_class; l++)
// {
// if (a[l] == -1)
// {
// cout << l;
// cout << " ";
// }
// }
// return 0;
//}
//
//#include <iostream>
//using namespace std;
//class Complex
//{
// int real, imaginary;
//public:
// Complex() {}
// Complex(int a, int b) { real = a; imaginary = b; }
// Complex plus(Complex a, Complex b)
// {
// Complex c;
// c.real = a.real + b.real;
// c.imaginary = a.imaginary + b.imaginary;
// return c;
// }
// Complex multiply(Complex a, Complex b)
// {
// Complex c;
// c.real = a.real * b.real - a.imaginary * b.imaginary;
// c.imaginary = a.imaginary * b.real + a.real * b.imaginary;
// return c;
// }
// void Output()
// {
// if (imaginary > 0)cout << real << '+' << imaginary << 'i' << endl;
// else if (imaginary == 0)cout << real << endl;
// else
// cout << real << imaginary << 'i' << endl;
// }
//};
//int main()
//{
// int x[3][2];
// for (int i = 0; i < 3; i++)cin >> x[i][0] >> x[i][1];
// Complex a(x[0][0], x[0][1]), b(x[1][0], x[1][1]), c(x[2][0], x[2][1]), d, e;
// d = d.plus(a, b); e = e.plus(d, c); e.Output();
// d = d.multiply(a, b); e = e.multiply(d, c); e.Output();
//}
//#include<iostream>
//using namespace std;
//class Complex
//{
// int real;
// int imaginary;
//public:
// Complex(){}
// Complex(int a, int b)
// :real(a), imaginary(b){}
// Complex add(Complex a, Complex b)
// {
// Complex c;
// c.real = a.real + b.real;
// c.imaginary = a.imaginary + b.imaginary;
// return c;
// }
// Complex multiply(Complex a, Complex b)
// {
// Complex c;
// c.real = a.real * b.real - a.imaginary * b.imaginary;
// c.imaginary = a.imaginary * b.real + a.real * b.imaginary;
// return c;
// }
// void print()
// {
// if (imaginary > 0)cout << real << '+' << imaginary << 'i' << endl;
// else if
// (imaginary == 0)cout << real << endl;
// else
// cout << real << imaginary << 'i' << endl;
// }
//
//};
//int main()
//{
// int x[3][2];
// for (int i = 0; i < 3; i++)
// cin >> x[i][0] >> x[i][1];
// Complex a(x[0][0], x[0][1]), b(x[1][0], x[1][1]), c(x[2][0], x[2][1]), d, e;
// d = d.add(a, b);
// e = e.add(d, c);
// e.print();
// d = d.multiply(a, b);
// e = e.multiply(d, c);
// e.print();
//}
//#include<iostream>
//#include<cmath>
//using namespace std;
//class Complex
//{
// int real;
// int imaginary;
//public:
// Complex(int a, int b)
// :real(a), imaginary(b){}
// int get_length(int a, int b)
// {
// int c = sqrt(a*a + b*b);
// return c;
// }
// bool operator>
//};
//int main()
//{
//}
/*#include <iostream>
using namespace std;
class Complex
{
int real,imaginary;
public:
Complex(int x = 0, int y = 0)
:real(x), imaginary(y){}
int operator<(const Complex& c2)
{
if ((*a + b * b)<(c2.a*c2.a + c2.b*c2.b))
return 1;
else
return 0;
}
Complex operator=(const Complex &c2)
{
a = c2.a;
b = c2.b;
return *this;
}
void print()
{
if (b>0)
cout << a << "+" << b << "i" << endl;
if (b<0)
cout << a << b << "i" << endl;
if (b == 0)
cout << a << endl;
}
};
int main()
{
int a1, b1, a2, b2, a3, b3;
cin >> a1 >> b1;
cin >> a2 >> b2;
cin >> a3 >> b3;
Complex c1(a1, b1);
Complex c2(a2, b2);
Complex c3(a3, b3);
Complex t;
if (!(c1 < c2))
{
t = c1;
c1 = c2;
c2 = t;
}
if (!(c2 < c3))
{
t = c2;
c2 = c3;
c3 = t;
}
if (!(c1 < c2))
{
t = c1;
c1 = c2;
c2 = t;
}
c1.print();
c2.print();
c3.print();
return 0;
*/
/*#include <iostream>
using namespace std;
class Complex
{
int a, b;
public:
Complex(int x = 0, int y = 0)
{
a = x;
b = y;
}
int operator<(const Complex& c2)
{
if ((a*a + b * b)<(c2.a*c2.a + c2.b*c2.b))
return 1;
else
return 0;
}
Complex operator=(const Complex &c2)
{
a = c2.a;
b = c2.b;
return *this;
}
void print()
{
if (b>0)
cout << a << "+" << b << "i" << endl;
if (b<0)
cout << a << b << "i" << endl;
if (b == 0)
cout << a << endl;
}
};
int main()
{
int a1, b1, a2, b2, a3, b3;
cin >> a1 >> b1;
cin >> a2 >> b2;
cin >> a3 >> b3;
Complex c1(a1, b1);
Complex c2(a2, b2);
Complex c3(a3, b3);
Complex t;
if (!(c1 < c2))
{
t = c1;
c1 = c2;
c2 = t;
}
if (!(c2 < c3))
{
t = c2;
c2 = c3;
c3 = t;
}
if (!(c1 < c2))
{
t = c1;
c1 = c2;
c2 = t;
}
c1.print();
c2.print();
c3.print();
}*/
//#include<iostream>
//using namespace std;
//class Complex
//{
// int real;
// int imaginary;
//public:
// Complex(){}
// Complex(int a, int b)
// {
// real = a;
// imaginary = b;
// }
// int operator <(const Complex &m)
// {
// if ((real*real + imaginary*imaginary) < (m.real*m.real + m.imaginary*m.imaginary))
// return 1;
// else
// return 0;
// }
// Complex operator =(const Complex &m)
// {
// real = m.real;
// imaginary = m.imaginary;
// return *this;
// }
// void print()
// {
// if (imaginary > 0)
// {
// cout << real << "+" << imaginary << "i" << endl;
// }
// if (imaginary == 0)
// {
// cout << real << endl;
// }
// if (imaginary < 0)
// {
// cout << real << imaginary << "i" << endl;
// }
// }
//
//};
//int main()
//{
// int r1, i1, r2, i2, r3, i3;
// cin >> r1 >> i1;
// cin >> r2 >> i2;
// cin >> r3 >> i3;
// Complex c1(r1, i1);
// Complex c2(r2, i2);
// Complex c3(r3, i3);
// Complex t;
// if (!(c1 < c2))
// {
// t = c1;
// c1 = c2;
// c2 = t;
// }
// if (!(c2 < c3))
// {
// t = c2;
// c2 = c3;
// c3 = t;
// }
// if (!(c1 < c2))
// {
// t = c1;
// c1 = c2;
// c2 = t;
// }
// c1.print();
// c2.print();
// c3.print();
// return 0;
//}
//#include <iostream>
//using namespace std;
//int strlength(char *a)
//{
// int count = 0;
// while (*a++)
// {
// count++;
// }
// return count;
//}
//int main()
//{
// int n1, n2;
// char *list1 = "See no evil, hear no evil,";
// char *list2 = "blind and deaf?";
// n1 = strlength(list1);
// n2 = strlength(list2);
// cout << list1 << endl;
// cout << "The length of list1 = " << n1 << endl;
// cout << list2 << endl;
// cout << "The length of list2 = " << n2 << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Complex
//{
// int real;
// int imaginary;
//public:
// Complex(){}
// Complex(int a, int b)
// :real(a), imaginary(b){}
// void init(int a, int b)
// {
// real = a;
// imaginary = b;
// }
// void print()
// {
// if (imaginary > 0)
// {
// cout << real << "+" << imaginary << "i" << endl;
// }
// if (imaginary == 0)
// {
// cout << real << endl;
// }
// if (imaginary < 0)
// {
// cout << real << imaginary << "i" << endl;
// }
// }
// friend bool operator<(Complex &c1, Complex &c2)
// {
// return c1.real < c2.real || (c1.real == c2.real && c1.imaginary< c2.imaginary);
// }
// friend bool operator>(Complex &c1, Complex &c2)
// {
// return c1.real > c2.real || (c1.real == c2.real && c1.imaginary > c2.imaginary);
// }
//};
//class Complexarry
//{
// Complex arry[20];
// Complex temp;
// int n;
//public:
// Complexarry(int n)
// {
// this->n = n;
// int a, b;
// for (int i = 0; i < n; i++)
// {
// cin >> a >> b;
// arry[i].init(a, b);
// }
// }
// void sort()
// {
// for (int i = 0; i < n-1; i++)
// {
// for (int j = n-1; j >i; j--)
// {
// if (arry[j] < arry[j - 1])
// {
// temp = arry[j];
// arry[j] = arry[j - 1];
// arry[j - 1] = temp;
// }
// }
// }
// for (int k = 0; k < n; k++)
// {
// arry[k].print();
// }
// }
//};
//int main()
//{
// int n;
// cin >> n;
// Complexarry m(n);
// m.sort();
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Rect
//{
// int length;
// int width;
//public:
// //构造函数
// Rect(int a = 0, int b = 0)
// :length(a), width(b){}
// //拷贝构造函数
// Rect(Rect &c)
// {
// length = c.length;
// width = c.width;
// }
// //set函数
// void set(int a,int b)
// {
// length = a;
// width = b;
// }
// //计算面积
// void GetArea()
// {
// cout << length*width << endl;
// }
//};
//int main()
//{
// int l, w;
// cin >> l >> w;
// Rect t(l, w);
// t.GetArea();
// return 0;
//}
//#include<iostream>
//#include<cmath>
//using namespace std;
//class Vector2d
//{
// int x, y;
//public:
// Vector2d (int a, int b)
// : x(a), y(b){}
// Vector2d(){};
// void friend operator -(Vector2d &m, Vector2d &n)
// {
// cout << sqrt((m.x - n.x)*(m.x - n.x) + (m.y - n.y)*(m.y-n.y))
// }
// void friend ostream <<()
//};
//int main()
//{
//
//}
//#include <iostream>
//#include <string>
//using namespace std;
//int main()
//{
// char phone_number[20];
// char *qp = phone_number; //定义一个字符指针qp指向字符串phone_number
// int quhao = 0; //区号
// long int number = 0; // 电话号码
// cout << "please input a phone number with the format(999)99999-999:" << endl;
// cin >> phone_number;
// //atoi(phone_number);
// quhao += strtok("(", ")");
// atoi(quhao);
// cout << "区号是:" << quhao << endl;
// cout << "电话号码是:" << number << endl;
// return 0;
//}
//
//#include <iostream>
//#include <string>
//using namespace std;
//int main()
//{
// char phone_number[20];
// char *qp = phone_number; //定义一个字符指针qp指向字符串phone_number
// int quhao = 0; //区号
// long int number = 0; // 电话号码
// cout << "please input a phone number with the format(999)99999-999:" << endl;
// cin >> phone_number;
// char *e = ")";
// char *p=strtok(phone_number,e);
// *p++;
// cout << "区号是:" << endl;
// for (int i = 0; i < 3; i++)
// {
// cout<<*p++;
// }
// cout << endl;
// char *s = "-";
// char *q = strtok(phone_number, s);
//
// while (*q++)
// {
// cout << *q;
// }
// return 0;
//}
/*#include<iostream>
#include<string>
using namespace std;
int main()
{
string Phone_number;
cin >> Phone_number;
cout << Phone_number << endl;
int Phone_number1[15] = atoi(Phone_number);
for (unsigned int i = 0; i < Phone_number.length(); i++)
{
if (Phone_number1[i] >= ' 0 '&& Phone_number1[i] <=' 9')
cout << Phone_number[i];
}
//string quhao = Phone_number.substr(1, 3);
//cout << quhao << endl;
return 0;
}*/
//#include<iostream>
//#include<cmath>
//using namespace std;
//class Vector2d
//{
// double x, y;
//public:
// Vector2d(){}
// Vector2d(int a, int b)
// :x(a), y(b){}
// double operator -(const Vector2d &t)const
// {
// return sqrt((t.x - x)*(t.x - x) + (t.y - y)*(t.y - y));
// }
// friend ostream &operator<<(ostream &out, Vector2d c)
// {
// out << "(" << c.x << "," << c.y << ")" << endl;
// return out;
// }
//};
//int main()
//{
// double x1, y1, x2, y2;
// cin >> x1 >> y1 >> x2 >> y2;
// Vector2d p(x1,y1), q(x2,y2);
// cout << p - q << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//#define N 3
//class City
//{
// char *name;
//public:
// City(char *name1)
// :name(name1){}
// City(){}
// bool operator>(City &p)
// {
// return this->name;
// }
// friend ostream &operator<<(ostream &out, City a)
// {
// out << a.name;
// return out;
// }
//};
//void sort(City city[], int n)
//{
// City temp;
// for (int i = 0; i < n - 1; i++)
// {
// for (int j = i + 1; j < n; j++)
// {
// if (city[i]>city[j])
// {
// temp = city[i];
// city[i] = city[j];
// city[j] = temp;
// }
// }
// }
//}
//int main()
//{
// City city[N] = { "Nanjing", "Beijing", "Shsnghai" };
// for (int i = 0; i < N; i++)
// {
// cout << city[i] << endl;
// }
// cout << "After sort"<<endl;
// sort(city,N);
// for (int i = 0; i < N; i++)
// {
// cout << city[i]<<endl;
// }
// return 0;
//}
//#include<iostream>
//#include<fstream>
//#include<sstream>
//#include<vector>
//using namespace std;
//typedef vector<vector<int>>Mat;
//Mat input();
//void mysort(Mat &a);
//void print(const Mat &a);
//int main()
//{
// Mat a = input();
// mysort(a);
// print(a);
//}
//Mat input()
//{
// ifstream
//}
//void mysort(Mat &a)
//void print(const Mat &a)
//#include<iostream>
//using namespace std;
//class Animal
//{
// int weight;
//public:
// Animal(int w)
// {
// weight = w;
// }
// int getweight()
// {
// cout << "Animal getweight" << endl;
// return weight;
// }
// virtual void print()
// {
// cout << "Animal::print" << endl;
// }
//};
//class Dog :public Animal
//{
// char voice;
//public:
// Dog(int w, char v) :Animal(w)
// {
// voice = v;
// }
// virtual void print()
// {
// cout << "Dog::print" << voice << endl;
// }
//};
//int main()
//{
// Dog dg(50, 'w');
// Animal *pd = &dg;
// pd->getweight();
// pd->print();
//}
//#include<iostream>
//using namespace std;
//int &add(int a, int b)//返回别名
//{
// int c = a + b;
// return c;
//}
//int main()
//{
// int ret = add(3, 4);
// add(1, 2);
// cout << ret << endl;
// return 0;
//}
////
//#include<iostream>
//using namespace std;
//class Array
//{
// int *data, n;
//public:
// Array(int x1, int x2)
// {
// n = x2 - x1 + 1;
// data = new int[n];
// for (int i = 0; i < n; i++)
// {
// data[i] = x1 + i;
// }
// }
// Array(Array &a)
// {
// n = a.n;
// data = new int[n];
// for (int i = 0; i < n; i++)
// {
// data[i] = a.data[i];
// }
// }
// ~Array()
// {
// delete[]data;
// }
// Array & operator+(Array &a)
// {
// Array *pv = new Array(*this);
// for (int i = 0; i < n; i++)
// {
// pv->data[i] += a.data[i];
// }
// return *pv;
// }
// friend ostream &operator<<(ostream &out, Array &a)
// {
// for (int i = 0; i < a.n; i++)
// {
// out << a.data[i] << " ";
// }
// return out << endl;
// }
//};
//int main()
//{
// Array a(10, 20);
// Array b(20, 30);
// Array c(a + b);
// cout << c << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Date
//{
// int _y;
// int _m;
// int _d;
//public:
// Date(int y, int m, int d)
// :_y(y), _m(m), _d(d){}
// bool isLeap()
// {
// return (_y % 400 == 0 || (_y % 4 == 0 && _y % 100 != 0));
// }
// int MonthDay()
// {
// int ds[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
// if (_m == 2)
// {
// ds[2] = 29;
// }
// return ds[_m];
// }
//};
//int main()
//{
// Date d(2020, 2, 26);
// if (d.isLeap() == true)
// cout << "是闰年" << endl;
// cout << d.MonthDay() << endl;
// return 0;
//}
////#include<iostream>
////#include<string>
////using namespace std;
////class Advisor
////{
//// int noOfMeeting;
////};
////class Student
////{
//// string name;
//// int semesterHours;
//// double average;
////public:
//// Student(string pName = "noName")
//// :name(pName), average(0), semesterHours(0){}
//// void addCourse(int hours, double grade)
//// {
//// double totalGrade = (semesterHours*average + grade);
//// semesterHours += hours;
//// average = semesterHours ? totalGrade / semesterHours : 0;
//// }
//// void display()
//// {
//// cout << "name=\"" << name << "\"" << ",hours=" << semesterHours << ",average=" << average << endl;
//// }
//// int getHours()
//// {
//// return semesterHours;
//// }
//// double getAverage()
//// {
//// return average;
//// }
////};
////class GraduateStudent :public Student
////{
//// Advisor advisor;
//// int qualifierGrade;
////public:
//// int getQualifier()
//// {
//// return qualifierGrade;
//// }
////};
////int main()
////{
//// Student ds("lo lee undergrade");
//// GraduateStudent gs;
//// ds.addCourse(3, 2.5);
//// ds.display();
//// gs.addCourse(3, 3.0);
//// gs.display();
//// return 0;
////}
//#include <iostream>
//using namespace std;
//class SeqList
//{
// int a[205], n;
//public:
// SeqList()
// {
//
// }
// void init(int b[], int n)
// {
// this->n = n;
// for (int i = 0; i < n; i++)
// {
// a[i] = b[i];
// }
// }
// void Insert(int x)
// {
// a[n] = x;
// n++;
// }
// void Remove(int k)
// {
// for (int i = k; i < n - 1; i++)
// {
// a[i] = a[i + 1];
// }
// n--;
// }
// void SearchRemove(int x)
// {
// for (int i = 0; i < n; i++)
// {
// if (a[i] == x)
// {
// Remove(i);
// }
// }
// }
// void print()
// {
// for (int i = 0; i < n; i++)
// cout << a[i] << " ";
// }
//};
//int main()
//{
// int n;
// cin >> n;
// int b[205];
// for (int i = 0; i < n; i++)
// {
// cin >> b[i];
// }
// SeqList L;
// L.init(b, n);
// int m; cin >> m;
// int c[205];
// for (int i = 0; i < m; i++)
// {
// cin >> c[i];
// if (c[i] > 0)
// L.Insert(c[i]);
// if (c[i] < 0)
// L.SearchRemove(-c[i]);
// }
// L.print();
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// int a = 10;
// int *pa = &a;
// *pa = 20;
// cout << a << endl;
// int b = 10;
// int *&pb = pa;
// pb = &b;
// cout << a << endl;
// cout << b << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//#define ADD(a,b) ((a)+(b))
//int main()
//{
// using namespace std;
// cout<<ADD(1, 2)<<endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//inline int add(int a, int b)
//{
//
// return a + b;
//}
//int main()
//{
// cout << add(1, 2) << endl;
// return 0;
//}
//auto的用法
//#include<iostream>
//using namespace std;
//int main()
//{
// int a = 10;
// auto b = a;//自动推导b的类型
// cout << b << endl;
// return 0;
//}
//
//#include<iostream>
//using namespace std;
//int main()
//{
// /*int x = 10;
// auto a = &x;
// auto* b = &x;
// int &y = x;
// auto c = y;
// auto &d = x;
// cout << typeid(x).name() << endl;
// cout << typeid(y).name() << endl;
// cout << typeid(a).name() << endl;
// cout << typeid(d).name() << endl;*/
// //int arry[] = { 1, 2, 3, 4, 5 };
// ////范围for
// //for(auto e:arry)
// //{
// // cout << e << " ";
// //}
// //cout << endl;
// //return 0;
// /*int arry[] = { 1, 2, 3, 4, 5 };
// for (auto &e : arry)
// {
// e *= 2;
// }
// for (auto ee : arry)
// {
// cout << ee << " ";
// }
// cout << endl;*/
//
// return 0;
//}
////auto不能声明参数,不能声明数组
//#include<iostream>
//using namespace std;
//class Base
//{
// int a;
//public:
// void print()
// {
// cout << a << endl;
// }
//};
//class Derived :public Base
//{
// int b;
//public:
// void display()
// {
// cout << a << endl;
// }
//};
//int main()
//{
// Derived d;
// //d.print();
// d.display();
// cout << d.a;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Bed
//{
//protected:
// int weight;
//public:
// Bed()
// :weight(0){}
// void Sleep()const
// {
// cout << "Sleeping ^^^" << endl;
// }
// void setWeight(int i)
// {
// weight = i;
// }
//};
//class Sofa
//{
//protected:
// int weight;
//public:
// Sofa()
// :weight(0){}
// void watchTV()const
// {
// cout << "Watvhing TV" << endl;
// }
// void setWeight(int i)
// {
// weight = i;
// }
//};
//class SleeperSofa:public Bed,public Sofa
//{
//public:
// SleeperSofa(){}
// void foldOut()const
// {
// cout << "Fold the sofa" << endl;
// }
//};
//int main()
//{
// SleeperSofa ss;
// ss.watchTV();
// ss.foldOut();
// ss.Sleep();
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Furniture
//{
//protected:
// int weight;
//public:
// Furniture(){}
// void setweight(int i)
// {
// weight = i;
// }
// int getweight()const
// {
// return weight;
// }
//};
//class Bed:virtual public Furniture
//{
//public:
// Bed(){}
// void sleep()const
// {
// cout << "Sleeping " << endl;
// }
//};
//class Sofa: virtual public Furniture
//{
//public:
// Sofa(){}
// void watchTV()const
// {
// cout << "Watching " << endl;
// }
//};
//class SleeperSofa:public Bed,public Sofa
//{
// SleeperSofa()
// :Sofa(), Bed(){}
// SleeperSofa(){}
// void foldout()const
// {
// cout << "fold out" << endl;
// }
//};
//int main()
//{
// SleeperSofa ss;
// ss.setweight(20);
// cout << ss.setweight() << endl;
//}
//#define _CRT_SECURE_NO_WARNINGS 1
//
//#include"accountlist.h"
//#include"savings.h"
//#include"checking.h"
//int main()
//{
// Savings s1("101", 2000), s2("102", 4000);
// Checking c1("201"), c2("312", 10000);
// Accountlist a;
// a.add(s1);
// a.add(s2);
// a.add(c1);
// a.add(c2);
// Account *p;
// if (p = a.find("101"))p->deposit(100);
// if (p = a.find("201"))p->deposit(2000);
// if (p = a.find("102"))p->withdrawal(2500);
// if (p = a.find("312"))p->withdrawal(2950);
// a.display();
// system("pause");
// return 0;
//}
//#define _CRT_SECURE_NO_WARNINGS 1
//
//#include<iostream>
//using std::cout;
//#include"accountlist.h"
//void Accountlist::add(Account &a)
//{
// Node *pN = new Node(a);
// if (first)
// {
// pN->next = first;
// first->prev = pN;
// }
// first = pN;
// size++;
//}
//
//void Accountlist::remove(string acntNo)
//{
// for (Node *p = first; p; p = p->next)
// if ((p->acnt).getAcntNo() == acntNo)
// {
// if (p->prev)p->prev->next = p->next;
// if (p->next)p->next->prev = p->prev;
// if (p == first)first = p->next;
// delete p;
// size--;
// break;
// }
//}
//
//Account *Accountlist::find(string acntNo)const
//{
// for (Node *p = first; p; p = p->next)
// if ((p->acnt).getAcntNo() == acntNo)
// return &(p->acnt);
// return 0;
//}
//
//void Accountlist::display()const
//{
// std::cout << "There are " << size << " accounts.\n";
// for (Node *p = first; p; p->next)
// (p->acnt).diaplay();
//}
//
//Accountlist::~Accountlist()
//{
// for (Node *p = first; p = first; delete p)
// first = first->next;
//}
//
//#ifndef ACCOUNTLIST
//#define ACCOUNTLIST
//#include"account.h"
//class Node
//{
//public:
// Account &acnt;
// Node *next, *prev;
// Node(Account &a)
// :acnt(a), next(0), prev(0){}
// bool operator==(const Node &n)const
// {
// return acnt == n.acnt;
// }
//};
//
//class Accountlist
//{
// int size;
// Node *first;
//public:
// Accountlist()
// : first(0), size(0){}
// Node*getFirst()const
// {
// return first;
// }
// int getSize()const
// {
// return size;
// }
// void add(Account &a);
// void remove(string acntNo);
// Account *find(string acntNo)const;
// bool isEmpty()const
// {
// return !size;
// }
// void display()const;
// ~Accountlist();
//};
//
//#endif
//#define _CRT_SECURE_NO_WARNINGS 1
//
//#include<iostream>
//#include"checking.h"
//Checking::Checking(string acntNo, double balan)
//:Account(acntNo, balan), remittance(other){}
//
//void Checking::display()const
//{
// std::cout << "Checking ";
// Account::diaplay();
//}
//
//void Checking::withdrawal(double amount)
//{
// if (remittance == remitByPost)
// amount += 30;
// if (remittance == remitByCable)
// amount += 60;
// if (balance < amount)
// std::cout << "Insufficient funds withdrawal: " << amount << "\n";
// else
// balance -= amount;
//}
//
//#ifndef HEADER_CHECKING
//#define HEADER_CHECKING
//#include"account.h"
//
//enum REMIT
//{
// remitByPost, remitByCable, other
//};//信汇,电汇,其他
//class Checking :public Account
//{
// REMIT remittance;
//public:
// Checking(string acntNo, double balan = 0.0);
// void withdrawal(double amount);
// void display()const;
// void setRemit(REMIT re)
// {
// remittance = re;
// }
//};
//
//#endif
//
//#define _CRT_SECURE_NO_WARNINGS 1
//
//#include<iostream>
//#include"savings.h"
//
//void Savings::display()const
//{
// std::cout << "Savings ";
// Account::diaplay();
//}
//
//void Savings::withdrawal(double amount)
//{
// if (balance < amount)
// std::cout << "Insuffcient funds withdrawal: " << amount << "\n";
// else
// balance -= amount;
//#ifndef HEADER_SAVINGS
//#define HEADER_SAVINGS
//
//#include"account.h"
//#include<string>
// using std::string;
// class Savings :public Account
// {
// public:
// Savings(string acntNo, double balan = 0.0)
// :Account(acntNo, balan){}
// void display()const;
// void withdrawal(double amount);
// };
//
//#endif
//
//#define _CRT_SECURE_NO_WARNINGS 1
//
//#include<iostream>
//#include"account.h"
//
// Account::Account(string anctNo, double balan)
// :acntNumber(anctNo), balance(balan){}
//
// void Account::diaplay()const
// {
// std::cout << "Account:" + acntNumber + "=" << balance << "\n";
// }
//
//#ifndef HEADER_ACCOUNT
//#define HEADER_ACCOUNT
//
//#include<string>
// using std::string;
// class Account
// {
// protected:
// string acntNumber;
// double balance;
// public:
// Account(string anctNo, double balan = 0.0);
// virtual void diaplay()const;
// double getBalan()const
// {
// return balance;
// }
// void deposit(double amount)
// {
// balance += amount;
// }
// bool operator==(const Account &a)
// {
// return acntNumber == a.acntNumber;
// }
// string getAcntNo()
// {
// return acntNumber;
// }
// virtual void withdrawal(double amount) = 0;
// };
//
//#endif
//#include<iostream>
//using namespace std;
//int main()
//{
// cout << "hello,world" << endl;
// return 0;
//}
//
//#include<stdio.h>
//namespace my_name
//{
// int a;
// int a;
//
// namespace my_name1
// {
// int a;
// namespace my_name2
// {
// int a;
// }
// }
//}
//int main()
//{
// int a;
// scanf("%d", &a);
// printf("%d\n", a);
// //printf("%d\n", my_name::scanf);
// return 0;
//}
//#include<stdio.h>
//namespace my_name
//{
// int a=12;
//}
//int main()
//{
// printf("%d",my_name:: a);
// return 0;
//}
//#include<iostream>
//using std::cout;
//
//int main()
//{
// cout << "hello,world" <<std::endl;
// return 0;
//}
//
//#include<iostream>
//using namespace std;
//int main()
//{
// int a;
// int b;
// printf("请输入a的值\n");
// scanf("%d", &a);
// printf("%d\n", a);
// cout << "请输入b的值" << endl;
// cin >> b;
// cout << b<<"\n";
// return 0;
//}
//#include<iostream>
//using namespace std;
//void TestFunc(int a = 0)
//{
// cout << a << endl;
//}
//int main()
//{
// TestFunc();
// TestFunc(10);
//}
//#include<iostream>
//using namespace std;
//int n;
//void TestFunc(int a , int b = 10, int c=n)
//{
// cout << "a = " << a << endl;
// cout << "b = " << b << endl;
// cout << "c = " << c << endl<<endl;
//}
//int main()
//{
// TestFunc(4);
// TestFunc(4,5);
// TestFunc(4,5,6);
// return 0;
//}
////a.h
//void TestFunc(int a = 10);
//// a.c
//void TestFunc(int a = 20)
//{}
//// 注意:如果生命与定义位置同时出现,
////恰巧两个位置提供的值不同,
////那编译器就无法确定到底该用那
////个缺省值。
//#include<iostream>
//using namespace std;
//#include<iostream>
//using namespace std;
//int main()
//{
// cout << "give up her\n" << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int f(int a, int b)
//{
//}
//void f(int a, int b)
//{
//}
//int main()
//{
//
//}
//
//#include<iostream>
//using namespace std;
//int add(int a, int b)
//{
// return a + b;
//}
//double add(double a, double b)
//{
// return a + b;
//}
//
//int main()
//{
// cout << add(1, 2) << endl;
// cout << add(1.51, 2.51) << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class ClassA
//{
// int data;
//public:
// ClassA(int n)
// {
// data = n;
// }
//
//};
//int main()
//{
// ClassA* a1 = new ClassA(5);
// ClassA a2();
// ClassA a3(3);
// return 0;
//}
//#include<iostream>
//using namespace std;
//int c = 30;
//class class1
//{
//private:
// int a;
// static int b;
//public:
// class1()
// {
// a = 10;
// }
// void set(int x, int y, int z)
// {
// a += x;
// b += y;
// c += z;
// }
// void display()
// {
// cout << a << " " << b << " " << c << endl;
// }
//};
//int class1::b = 20;
//int main()
//{
// class1 a1, a2;
// a1.set(1, 2, 3);
// a1.display();
// a2.set(4, 5, 6);
// a2.display();
//}
//#include<iostream>
//using namespace std;
//class Class2
//{
// int x;
//public:
// Class2(int i)
// {
// x = i;
// cout << "1 " << x << endl;
// }
// Class2(double i)
// {
// x = (int)i * 2;
// cout << "2 " << x<<endl;
// }
// ~Class2()
// {
// cout << "3 " << x << endl;
// }
//};
//int main()
//{
// int a = 10;
// double b = 3.5;
// Class2 a1(a), a2(a * 1.0);
// Class2 *a3 = new Class2(b);
// delete a3;
// return 0;
//}
//
//
//#include<iostream>
//using namespace std;
//class ClassA
//{
// int x;
//public:
// ClassA(int i)
// {
// x = i;
// }
// void disp()
// {
// cout << x << ",";
// }
//};
//class ClassB :public ClassA
//{
// int x;
//public:
// ClassB(int i) :ClassA(i + 10)
// {
// x = i;
// }
// void disp()
// {
// ClassA::disp();
// cout << x << endl;
// }
//};
//int main()
//{
// ClassB b(3);
// b.disp();
// return 0;
//}
//#include<iostream>
//#include<string>
//using namespace std;
//class studentid
//{
// int value;
//public:
// studentid(int id = 0)
// {
// value = id;
// cout << "Assigning student id " << value << endl;
// }
//};
//class student
//{
// string name;
// studentid id;
//public:
// student(string n = "noname", int ssid = 0)
// :id(ssid), name(n)
// {
// cout << "constructing student " << n << endl;
// }
//};
//int main()
//{
// student s("jack", 100);
// student t("tom");
//}
//
//#include<iostream>
//using namespace std;
//class A
//{
//public:
// virtual void show()
// {
// cout << "show A" << endl;
// }
//};
//class B:public A
//{
// void show()
// {
// cout << "show B" << endl;
// }
//};
//void fun(A*ptr, A&ref, A b)
//{
// ptr->show();
// ref.show();
// b.show();
//}
//int main()
//{
// A a, *p = new B;
// B b;
// fun(p, a, b);
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Count
//{
// int n;
//public:
// Count(int i)
// {
// n = i;
// }
// int &operator++()
// {
// n += 5;
// return n;
// }
// int operator++(int)
// {
// int t = n;
// n += 10;
// return t;
// }
// Count operator+(Count &c2);
// void show()
// {
// cout << n << endl;
// }
//};
//Count Count::operator+(Count &c2)
//{
// return Count(n + c2.n);
//}
//int main()
//{
// Count A(10), B(10);
// A++;
// A.show();
// ++B;
// B.show();
// (A + B).show();
// return 0;
//}
//#include<iostream>
//using namespace std;
//class base
//{
//public:
// base()
// {
// cout << "cb " << endl;
// }
// ~base()
// {
// cout << "db " << endl;
// }
//};
//class sub1 :virtual public base
//{
//public:
// sub1()
// {
// cout << "cs1 " << endl;
// }
// ~sub1()
// {
// cout << "ds1 " << endl;
// }
//};
//class sub2 :virtual public base
//{
//public:
// sub2()
// {
// cout << "cs2 " << endl;
// }
// ~sub2()
// {
// cout << "ds2 " << endl;
// }
//};
//class sub3 :public sub1, public sub2
//{
//public:
// sub3()
// {
// cout << "cs3 " << endl;
// }
// ~sub3()
// {
// cout << "ds3 " << endl;
// }
//};
//int main()
//{
// sub3 s;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// int a = 10;
// int b = 20;
// cout << a << " " << b << endl;
// int &ra = a;
// cout << a << " " << b << " " << ra<<endl;
// ra = b;
// cout << a << " " << b << " " << ra<<endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// int a = 10;
// int b = 20;
// int &ra = a;
// ra = b;
// cout << ra << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// const int a = 10;
// const int &ra = a;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// int b = 10;
// int &rb = b;
// const int &crb = b;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// int b = 10;
// const double &rb = b;
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
//
//}
//void swap(int &left,int right)
//{
// int temp = left;
// left = right;
// right = temp;
//}
//int& Count()
//{
// static int n = 0;
// n++;
// return n;
//}
//#include<iostream>
//using namespace std;
//int& Add(int a, int b)
//{
// int c = a + b;
// return c;
//}
//int main()
//{
// int& ret = Add(1, 2);
// Add(3, 4);
// cout << "Add(1, 2) is :" << ret << endl;
// return 0;
//}
//#include<iostream>
//#include <time.h>
//using namespace std;
//struct A
//{
// int a[10000];
//};
//void TestFunc1(A a){}
//void TestFunc2(A& a){}
//void TestRefAndValue()
//{
// A aa;
// // 以值作为函数参数
// size_t begin1 = clock();
// for (size_t i = 0; i < 10000; ++i)
// TestFunc1(aa);
// size_t end1 = clock();
// // 以引用作为函数参数
// size_t begin2 = clock();
// for (size_t i = 0; i < 10000; ++i)
// TestFunc2(aa);
// size_t end2 = clock();
// // 分别计算两个函数运行结束后的时间
// cout << "TestFunc1(A)-time:" << end1 - begin1 << endl;
// cout << "TestFunc2(A&)-time:" << end2 - begin2 << endl;
//}
//int main()
//{
// TestRefAndValue();
// return 0;
//}
//
//#include<iostream>
//#include <time.h>
//using namespace std;
//struct A{ int a[10000]; };
//void TestFunc1(A a){}
//void TestFunc2(A& a){}
//void TestRefAndValue();
//int main()
//{
// A a;
// // 以值作为函数参数
// size_t begin1 = clock();
// for (size_t i = 0; i < 10000; ++i)
// TestFunc1(a);
// size_t end1 = clock();
// // 以引用作为函数参数
// size_t begin2 = clock();
// for (size_t i = 0; i < 10000; ++i)
// TestFunc2(a);
// size_t end2 = clock();
// // 分别计算两个函数运行结束后的时间
// cout << "TestFunc1(A)-time:" << end1 - begin1 << endl;
// cout << "TestFunc2(A&)-time:" << end2 - begin2 << endl;
//}
//
//#include<iostream>
//#include <time.h>
//using namespace std;
//struct A{ int a[10000]; };
//A a;
//// 值返回
//A TestFunc1() { return a; }
//// 引用返回
//A& TestFunc2(){ return a; }
//void TestReturnByRefOrValue(){}
//int main()
//{
// // 以值作为函数的返回值类型
// size_t begin1 = clock();
// for (size_t i = 0; i < 100000; ++i)
// TestFunc1();
// size_t end1 = clock();
// // 以引用作为函数的返回值类型
// size_t begin2 = clock();
// for (size_t i = 0; i < 100000; ++i)
// TestFunc2();
// size_t end2 = clock();
// // 计算两个函数运算完成之后的时间
// cout << "TestFunc1 time:" << end1 - begin1 << endl;
// cout << "TestFunc2 time:" << end2 - begin2 << endl;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// int a = 10;
// int& ra = a;
// ra = 20;
// int* pa = &a;
// *pa = 20;
// return 0;
//}
//
//#include <iostream>
//#include <cstdlib>
//#include <cmath>
//using namespace std;
//class Complex
//{
//private:
// double real, imag;
//public:
// Complex(double r);
// Complex(double r, double i);
// Complex(Complex cl, Complex c2);
// void print()
// {
// cout << real << "," << imag << endl;
// }
//};
//Complex::Complex(double r) //构造函数 1
//{
// real = r;
// imag = 0;
//}
//Complex::Complex(double r, double i) //构造数 2
//{
// real = r;
// imag = i;
//}
//Complex::Complex(Complex cl, Complex c2) //构造函数 3
//{
// real = cl.real + c2.real;
// imag = cl.imag + c2.imag;
//}
//int main() {
// Complex cl(3), c2(1, 2), c3(cl, c2), c4 = 7;
// print(c1);
// return 0;
//}
//
//#include <iostream>
//#include <cstdlib>
//#include <cmath>
//using namespace std;
//class Complex
//{
//private:
// double real, imag;
//public:
// Complex(double r);
// Complex(double r, double i);
// Complex(Complex cl, Complex c2);
// void print()
// {
// cout << real << "," << imag << endl;
// }
//};
//Complex::Complex(double r) //构造函数 1
//{
// real = r;
// imag = 0;
//}
//Complex::Complex(double r, double i) //构造数 2
//{
// real = r;
// imag = i;
//}
//Complex::Complex(Complex cl, Complex c2) //构造函数 3
//{
// real = cl.real + c2.real;
// imag = cl.imag + c2.imag;
//}
//int main() {
// Complex c1(3), c2(1, 2), c3(c1, c2), c4 = 7;
// c1.print();
// c2.print();
// return 0;
//}
//#include < iostream >
//using namespace std;
//class A
//{
//public:
//
// virtual `A()
// {
// cout << " A::A(called " << endl :
// }
//};
//
//class B : public A
//{
//public:
//
// B(int i)
// {
//
// buf = new char[i];
// }
//
// virtual `B()
// {
// delete[]buf;
//
// cout << B::BО called << endl;
// }
//
//private:
//
// char *buf;
//};
//
//void fun(A *a)
//{
// delete a;
//}
//
// int main()
// {
// A*a = newB(14);
// B*b = newB(13);
// B*c = newB(12);
// fun(a);
//
// fun(b);
//
// fun(c);
//
// return 0;
// }
//#include<iostream>
//using namespace std;
//class A
//{
//public:
// virtual ~A()
// {
// cout << "A::~A() called" << endl;
// }
//};
//class B :public A
//{
//public:
// B(int i)
// {
// buf = new char[i];
// }
// virtual ~B()
// {
// delete[]buf;
// cout << "B::~B called" << endl;
// }
//private:
// char *buf;
//};
//void fun(A*a)
//{
// delete a;
// cout << "delete" <<endl;
//}
//int main()
//{
// A *a = new B(14);
// B *b = new B(13);
// B *c = new B(12);
// fun(a);
// fun(b);
// fun(c);
// return 0;
//}
//#include<iostream>
//using namespace std;
//class A
//{
//public:
// virtual ~A()
// {
// cout << "A::~A() called" << endl;
// }
//};
//class B :public A
//{
//public:
// B(int i)
// {
// buf = new char[i];
// }
// virtual ~B()
// {
// delete[]buf;
// cout << "B::~B called" << endl;
// }
//private:
// char *buf;
//};
//void fun(A*a)
//{
// delete a;
// cout << "delete" <<endl;
//}
//int main()
//{
// A *a = new B(14);
// B *b = new B(13);
// B *c = new B(12);
// fun(a);
// fun(b);
// fun(c);
// return 0;
//}
//#include<iostream>
//using namespace std;
//class A
//{
//public:
// virtual ~A()
// {
// cout << "A::~A() called" << endl;
// }
//};
//class B :public A
//{
//public:
// B(int i)
// {
// buf = new char[i];
// }
// virtual ~B()
// {
// delete[]buf;
// cout << "B::~B called" << endl;
// }
//private:
// char *buf;
//};
//void fun(A*a)
//{
// delete a;
// cout << "delete" <<endl;
//}
//int main()
//{
// A *a = new B(14);
// B *b = new B(13);
// B *c = new B(12);
// fun(a);
// fun(b);
// fun(c);
// return 0;
//}
//#include<iostream>
//using namespace std;
//class A
//{
//public:
// virtual ~A()
// {
// cout << "A::~A() called" << endl;
// }
//};
//class B :public A
//{
//public:
// B(int i)
// {
// buf = new char[i];
// }
// virtual ~B()
// {
// delete[]buf;
// cout << "B::~B called" << endl;
// }
//private:
// char *buf;
//};
//void fun(A*a)
//{
// delete a;
// cout << "delete" <<endl;
//}
//int main()
//{
// A *a = new B(14);
// B *b = new B(13);
// B *c = new B(12);
// fun(a);
// fun(b);
// fun(c);
// return 0;
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// char str[] = "SSWLIA", c;
// int k;
// for (k = 2; (c = str[k]) != '\0'; k++)
// {
// switch (c)
// {
// case 'I':++k;
// break;
// case 'L':
// continue;
// default :
// cout << c; continue;
// }
// cout << '*';
// }
// return 0;
//}
//#include<iostream>
//using namespace std;
//class A
//{
// friend class B;
//public:
// int a;
//};
//class B
//{};
//class C :public B
//{
// void func(A *pt);
//};
//void C::func(A *pt)
//{
// pt->a++;
//}
//int main()
//{
//
//}
//#include<iostream>
//using namespace std;
//class ClassA
//{
// int data;
//public:
// ClassA(int n=1)
// {
// data = n;
// }
//};
//int main()
//{
// ClassA *a1=new ClassA();
// ClassA a2();
// ClassA a3;
// ClassA *p = new ClassA();
//}
//#include<iostream>
//using namespace std;
//class ClassA
//{
//public:
// ClassA(int i)
// {
// x = i;
// }
// void disp()
// {
// cout << x << ',';
// }
//private:
// int x;
//};
//class ClassB :public ClassA
//{
//public:
// ClassB(int i) :ClassA(i + 10)
// {
// x = i;
// }
// void disp()
// {
// ClassA::disp();
// cout << x << endl;
// }
//private:
// int x;
//};
//int main()
//{
// ClassB b(3);
// b.disp();
// return 0;
//}
//#include<iostream>
//using namespace std;
//int c = 30;
//class Class1
//{
//private:
// int a;
// static int b;
//public:
// Class1(){ a = 10; }
// void set(int x, int y, int z){ a += x, b += y, c += z; }
// void display(){ cout << a << " " << b << " " << c << endl; }
//};
//int Class1::b = 20;
//void main()
//{
// Class1 a1, a2;
// a1.set(1, 2, 3);
// a1.display();
// a2.set(4, 5, 6);
// a2.display();
//}
//#include <iostream>
//using namespace std;
//class Class2
//{
//public:
// Class2(int i)
// {
// x = i;
// cout << "construct1: " << x << "\n";
// }
// Class2(double i)
// {
// x = (int)i * 2;
// cout << "construct2: " << x << "\n";
// }
// ~Class2()
// {
// cout << " destruct : " << x << "\n";
// }
//private:
// int x;
//};
//void main()
//{
// int a = 10;
// double b = 3.5;
// Class2 a1(a), a2(a * 1.0);
// Class2 *a3 = new Class2(b);
// delete a3;
//}
//#include<iostream>
//#include <string>
//using namespace std;
//class StudentID{
// int value;
//public:
// StudentID(int id = 0){
// value = id;
// cout << "Assigning student id " << value << endl;
// }
//};
//class Student{
// string name;
// StudentID id;
//public:
// Student(string n = "no name", int ssID = 0) :id(ssID), name(n){
// cout << "Constructing student " << n << "\n";
// }
//};
//void main(){
// Student s("Jack", 100);
// Student t("Jone");
//}
//#include <iostream>
//using namespace std;
//class A
//{
//public:
// virtual void show()
// { cout << "show class A" << endl; }
//};
//class B :public A
//{
//public:
// void show()
// { cout << "show class B" << endl; }
//};
//void fun(A*ptr, A &ref, A b)
//{
// ptr->show();
// ref.show();
// b.show();
//}
//int main()
//{
// A a, *p = new B;
// B b;
// fun(p, a, b);
// return 0;
//}
//#include <iostream>
//using namespace std;
//class Count
//{
// int n;
//public:
// Count(int i){ n = i; }
// int & operator++(){ n += 5; return n; }
// int operator++(int){ int t = n; n += 10; return t; }
// Count operator+(Count &c2);
// void show(){ cout << n << '\n'; }
//};
//Count Count::operator+(Count &c2){
// return Count(n + c2.n);
//}
//void main()
//{
// Count A(10), B(10);
// A++;
// A.show();
// ++B;
// B.show();
// (A + B).show();
//}
//#include<iostream>
//using namespace std;
//class base
//{
//public:
// base(){ cout << "constructing base class" << endl; }
// ~base(){ cout << "destructing base class" << endl; }
//};
//class sub1 :virtual public base
//{
//public:
// sub1(){ cout << "constructing sub1 class" << endl; }
// ~sub1(){ cout << "destructing sub1 class" << endl; }
//};
//class sub2 :virtual public base
//{
//public:
// sub2(){ cout << "constructing sub2 class" << endl; }
// ~sub2(){ cout << "destructing sub2 class" << endl; }
//};
//class sub3 :public sub1, public sub2
//{
//public:
// sub3(){ cout << "constructing sub3 class" << endl; }
// ~sub3(){ cout << "destructing sub3 class" << endl; }
//};
//void main()
//{
// sub3 s;
//}
//#include<iostream>
//using namespace std;
//class Date
//{
// int day, month, year;
//public:
// Date()
// {}
// void set(int d, int m, int y)
// {
// day = d;
// month=m;
// year=y;
// }
// void print()
// {
// cout << year << "-" << month << "-" << day << endl;
// }
//};
//int main()
//{
// Date a;
// a.set(2020, 1, 1);
// a.print();
//}
//#include<iostream>
//using namespace std;
//class T
//{
//public:
// T(int x){ a = x; b += x; };
// static void display(T c)
// {
// cout << "a=" << c.a << '\t' << "b=" << c.b << endl;
// }
//private:
// int a;
// static int b;
//};
//int T::b = 5;
//void main()
//{
// T A(3), B(5);
// T::display(A);
// T::display(B);
//}
//#include <iostream>
//using namespace std;
//class Base
//{
//public:
// virtual void f(){ cout << "f0+"; }
// void g(){ cout << "g0+"; }
//};
//class Derived : public Base
//{
//public:
// void f(){ cout << "f+"; }
// void g(){ cout << "g+"; }
//};
//void main(){ Derived d; Base *p = &d; p->f(); p->g(); }
//#include<iostream>
//using namespace std;
//double pi = 3.1415;
//
//class Basic {
//public:
// virtual double getArea() = 0;//面积
// virtual double getVolume() = 0;//体积
//};
//
//class Circular :public Basic {
//protected:
// double radius;
//public:
// Circular(double r) :radius(r){
//
// }
// double getArea() {
// return pi * radius * radius;
// }
// double getVolume() {
// return 0.0;
// }
// ~Circular() {
//
// }
//};
//
//class Column :public Circular {
//private:
// double height;
//public:
// Column(double r, double h) :Circular(r), height(h) {
//
// }
// double getVolume() {
// return Circular::getArea()* height;
// }
// double getArea() {
// return 2 * Circular::getArea() + 2 * pi * radius * height;
// }
// ~Column() {
//
// }
//};
//
//int main() {
// Circular circle(5);
// Column column(4, 2);
// cout << circle.getArea() << endl;
// cout << circle.getVolume() << endl;
// cout << column.getArea() << endl;
// cout << column.getVolume() << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Test{
//public:
// Test(){}
// ~Test(){ cout << '#'; }
//};
//int main(){
// Test temp[2], *pTemp[2];
// return 0;
//}
//
//#include <iostream>
//using namespace std;
//class B1
//{
//public:
// int nv;
// void fun(){ cout << "Member of B1." << endl; }
//};
//class B2
//{
//public:
// int nv;
// void fun(){ cout << "Member of B2." << endl; }
//};
//class D1 :public B1, public B2
//{
//public:
// int nv;
// void fun(){ cout << "Member of D1." << endl; }
//};
//void main()
//{
// D1 d1;
// d1.nv = 1;
// d1.fun();
// d1.B1::nv = 2;
// d1.B1::fun();
// d1.B2::nv = 3;
// d1.B2::fun();
//}
//#include <iostream>
//using namespace std;
//class A{
//public:
// virtual void show(){ cout << "show class A" << endl; }
//};
//class B :public A {
//public:
// void show(){ cout << "show class B" << endl; }
//};
//void fun(A*ptr, A &ref, A b){
// ptr->show();
// ref.show();
// b.show();
//}
//int main(){
// A a, *p = new B;
// B b;
// fun(p, a, b);
// return 0;
//}
//#include<iostream>
//using namespace std;
// class BASE{
// char c;
// public:
// BASE(char n) :c(n){}
// ~BASE(){ cout << c; }
// };
// class DERIVED :public BASE{
// char c;
// public:
// DERIVED(char n) :BASE(n + 1), c(n){}
// ~DERIVED(){ cout << c; }
// };
// int main()
// {
// DERIVED('x');
// return 0;
// }
//#include<iostream>
//using namespace std;
//class B
//{
//public:
// B(){}
// B(int i){ b = i; }
// virtual void virfun()
// {
// cout << "B::virfun()called.\n";
// }
//private:
// int b;
//};
//class D :public B
//{
//public:
// D(){}
// D(int i, int j) :B(i){ d = j; }
//private:
// int d;
// void virfun()
// {
// cout << "D::virfun()called.\n";
// }
//};
//void fun(B *obj)
//{
// obj->virfun();
//}
//int main()
//{
// D *pd = new D;
// fun(pd);
// return 0;
//}
//#include <iostream>
//using namespace std;
//class A
//{
// int x;
//public:
// A(int a){ x = ++a; }
// ~A(){ cout << x << '\n'; }
// int get(){ return x; }
//};
//class B :public A
//{
// int y;
//public:
// B(int b) :A(b){ y = get() + b; }
// B() :A(5){ y = 6; }
// ~B(){ cout << y << '\n'; }
//};
//void main(void)
//{
// B b(5);
//}
//#include<iostream>
//using namespace std;
//int main()
//{
// cout<<"hello world!";
// return 0;
//}
//#include<iostream>
//using namespace std;
//inline int add(int a, int b)
//{
// return a + b;
//}
//inline int sub(int c, int d);
//int main()
//{
// cout<<add(1, 2)<<endl;
// cout << sub(4, 3) << endl;
// return 0;
//}
// int sub(int c, int d)
//{
// return c - d;
//}
//#include<iostream>
//using namespace std;
//#define ADD(a,b) (a+b)
//int main()
//{
// int x;
// x = ADD(1, 2)*2;
// cout << x << endl;
// return 0;
//}
//
//#include<iostream>
//using namespace std;
//#define ADD(int a,int b)
//{
// return a + b;
//}
//int main()
//{
// int x;
// x = ADD(1, 2) * 2;
// cout << x << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class student
//{
// int id;
// int test_score;
// void fail();
//};
//void student::fail()
//{
// if (test_score < 60)
// cout << "yes" << endl;
// else
// cout << "no" << endl;
//}
//int main()
//{
// student sst;
// cin >> sst.test_score;
// sst.fail();
//}
//#/*include<iostream>
//using namespace std;
//class student
//{
//private:
// int id;
//public:
// int score;
// void fail();
//};
//void student::fail()
//{
// if (score > 60)
// {
// cout << "no" << endl;
// }
// else
// {
// cout << "yes" << endl;
// }
//}
//int main()
//{
//}*/
//#include<iostream>
//using namespace std;
//int main()
//{
//
//}
//class Classname
//{
// //类体>>由成员变量和成员函数组成
//
//};
//#include<iostream>
//using namespace std;
//class student
//{
//public:
// int id;
// char *name;
// int score;
//};
//int main()
//{
// student st;
// st.id = 0000;
// st.name = "tom";
// st.score = 98;
//
//}
//#include<iostream>
//using namespace std;
//class student
//{
// int id;
// int score;
// int age;
// void fail()
// {
// if (score > 60)
// cout << "no" << endl;
// else
// cout << "yes" << endl;
// }
//};
//int main()
//{
// student st1;
// student st2;
// cout << sizeof(st1) << endl;
// cout << sizeof(st2) << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class A
//{
//
//};
//int main()
//{
// A a;
// cout << sizeof(a) << endl;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Date
//{
//public:
// void Display()//输出
// {
// cout << _year << "-" << _month << "-" << _day << endl;
// }
// void SetDate(Date* this,int year, int month, int day)//设置
// {
// this->_year = year;
// this->_month = month;
// this->_day = day;
// }
//private:
// int _year; // 年
// int _month; // 月
// int _day; // 日
//};
//int main()
//{
// Date d1, d2;
// d1.SetDate(&d1,2018, 5, 1);
// d2.SetDate(&d2,2018, 7, 1);
// d1.Display();
// d2.Display();
// return 0;
//}
//
//#include<iostream>
//using namespace std;
//class Date
//{
//private:
// int _year;
// int _month;
// int _day;
//};
//int main()
//{
//
//}
//#include<iostream>
//using namespace std;
//class Date
//{
//public:
// void SetDate(int year, int month, int day)
// {
// _year = year;
// _month = month;
// _day = day;
// }
// void Display()
// {
// cout << _year << "-" << _month << "-" << _day << endl;
// }
//private:
// int _year;
// int _month;
// int _day;
//};
//int main()
//{
// Date d1, d2;
// d1.SetDate(2018, 5, 1);
// d1.Display();
// Date d2;
// d2.SetDate(2018, 7, 1);
// d2.Display();
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Date
//{
//public:
// void SetDate(int year, int month, int day)
// {
// _year = year;
// _month = month;
// _day = day;
// }
// void Display()
// {
// cout << _year << "-" << _month << "-" << _day << endl;
// }
//private:
// int _year;
// int _month;
// int _day;
//};
//int main()
//{
// Date d1;
// d1.Display;
// return 0;
//}
//class Date
//{
//public:
// // 1.无参构造函数
// Date()
// {}
// // 2.带参构造函数
// Date(int year, int month, int day)
// {
// _year = year;
// _month = month;
// _day = day;
// }
//private:
// int _year;
// int _month;
// int _day;
//};
//void TestDate()
//{
// Date d1; // 调用无参构造函数
// Date d2(2015, 1, 1); // 调用带参的构造函数
// // 注意:如果通过无参构造函数创建对象时,对象后面不用跟括号,否则就成了函数声明
// // 以下代码的函数:声明了d3函数,该函数无参,返回一个日期类型的对象
// Date d3();
//}
//#include<iostream>
//using namespace std;
//class Date
//{
//public:
// /*Date()
// {
// _year = 1900;
// _month = 1;
// _day = 1;
// }*/
// Date(int year = 1900, int month = 1, int day = 1)
// {
// _year = year;
// _month = month;
// _day = day;
// }
//private:
// int _year;
// int _month;
// int _day;
//};
//// 以下测试函数能通过编译吗?
//int main()
//{
// Date d1;
//}
//#include<iostream>
//using namespace std;
//class Date
//{
//private:
// int _year;
// int _month;
// int _day;
//public:
// void display()
// {
// cout << _year << "-" << _month << "-" << _day << endl;
// }
//};
//int main()
//{
// Date d1;
// d1.display();
//}
//#include<iostream>
//using namespace std;
//class Time
//{
//public:
// Time()
// {
// cout << "Time()" << endl;
// }
//private:
// int _hour;
// int _minute;
// int _second;
//};
//class Date
//{
//private:
// // 基本类型(内置类型)
// int _year;
// int _month;
// int _day;
// // 自定义类型
// Time _t;
//};
//int main()
//{
// Date d;
// return 0;
//}
//#include<iostream>
//using namespace std;
//class A
//{
// int _a;
//public:
// A(int a=0)
// {
// cout << "A(int a=0)构造函数" << endl;
// _a = a;
// }
// void Print()
// {
// cout << _a << endl;
// }
//};
//class Date
//{
// int _year;
// int _month;
// int _day;
// A _aa;
//public:
// void print()
// {
// cout << _year << "-" << _month << "-" << _day << endl;
// _aa.Print();
// }
//};
//int main()
//{
// Date d;
// d.print();
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Date
//{
//private:
// int _year;
// int _month;
// int _day;
//public:
// Date(int year,int month,int day)
// {
// cout << "构造";
// _year = year;
// _month = month;
// _day = day;
// cout << _year << "-" << _month << "-" << _day<<endl;
// }
// ~Date()
// {
// cout << "析构" << _year << "-" << _month << "-" << _day << endl;
// }
//};
//int main()
//{
// Date d1(2021,7,21);
// Date d2(2022, 7, 21);
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Date
//{
//public:
// Date(int year = 1900, int month = 1, int day = 1)
// {
// _year = year;
// _month = month;
// _day = day;
// }
//private:
// int _year;
// int _month;
// int _day;
//};
//int main()
//{
// Date d1;
//
// // 这里d2调用的默认拷贝构造完成拷贝,d2和d1的值也是一样的。
// Date d2(d1);
// return 0;
//}
//#include<iostream>
//using namespace std;
//class String
//{
//public:
// String(const char* str = "jack")
// {
// _str = (char*)malloc(strlen(str) + 1);
// strcpy(_str, str);
// }
// ~String()
// {
// cout << "~String()" << endl;
// free(_str);
// }
//private:
// char* _str;
//};
//int main()
//{
// String s1("hello");
// String s2(s1);
//}
//#include<iostream>
//using namespace std;
//int main()
//{
//
//}
//#include<iostream>
//using namespace std;
//class Time
//{
// int hour;
// int minute;
// int second;
//public:
// Time(int a, int b, int c)
// {
// hour = a;
// minute = b;
// second = c;
// }
//};
//int main()
//{
// Time T1(8,12,24);
// Time T2(8, 12, 46);
// Time T3(9, 23, 12);
// cout << T1 - T2 << endl;
//}
//
//#include<iostream>
//using namespace std;
//
//#include<iostream>
//using namespace std;
//class Time
//{
// int hour;
// int minute;
// int second;
//public:
// Time(int a, int b, int c)
// {
// hour = a;
// minute = b;
// second = c;
// }
//};
//Time operator +(Time &t1, Time &t2)
//{
// Time t(t1.)
//}
//int main()
//{
// Time T1(8, 12, 24);
// Time T2(8, 12, 46);
// Time T3(9, 23, 12);
// cout << << endl;
//}
//
//
//
////返回值类型 operator 运算符(形参表)
////{
//// ……
////}
//#include<iostream>
//using namespace std;
//class Complex
//{
// int _a;
// int _b;
//public:
// Complex(int a, int b)
// {
// _a = a;
// _b = b;
// }
// void show()
// {
// cout << "(" << _a << "," << _b << ")" << endl;
// }
// friend Complex operator +(Complex &C1, Complex &C2);
//};
//Complex operator +(Complex &C1, Complex &C2)
//{
// Complex C(C1._a + C2._a, C1._b + C2._b);
// return C;
//}
//int main()
//{
// Complex C1(1, 2);
// Complex C2(2, 3);
// Complex C3 = C1 + C2;
// C3.show();
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Complex
//{
// int _a;
// int _b;
//public:
// Complex(int a, int b)
// {
// _a = a;
// _b = b;
// }
// void show()
// {
// cout << "(" << _a << "," << _b << ")" << endl;
// }
//
//};
//Complex operator +(Complex &C1, Complex &C2)
//{
//
//}
//int main()
//{
// Complex C1(1, 2);
// Complex C2(2, 3);
// Complex C3 = C1 + C2;
// C3.show();
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Complex
//{
// int _a;
// int _b;
//public:
// Complex(int a, int b)
// {
// _a = a;
// _b = b;
// }
// void show()
// {
// cout << "(" << _a << "," << _b << ")" << endl;
// }
// Complex &operator =(const Complex &C)
// {
// if (this != &C)
// {
// _a = C._a;
// _b = C._b;
// }
// return *this;
// }
//};
//int main()
//{
// Complex C1(1, 2);
// Complex C2 = C1;
// C2.show();
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Complex
//{
// int _a;
// int _b;
//public:
// Complex(int a, int b)
// {
// _a = a;
// _b = b;
// }
// void show()
// {
// cout << "(" << _a << "," << _b << ")" << endl;
// }
// bool operator <(const Complex C1)
// {
// if ((C1._a*C1._a + C1._b*C1._b) < (_a*_a + _b*_b))
// return true;
// else
// return false;
// }
//};
//int main()
//{
// Complex C1(1, 2);
// Complex C2(2, 3);
// if (C1 < C2)
// cout << "<" << endl;
// return 0;
//
// return 0;
//}
//#include <iostream>
//using namespace std;
//
//class Complex
//{
//public:
// Complex()
// {
// a = 0;
// b = 0;
// }
// //重载前置++
// Complex& operator++()
// {
// a++;
// b++;
// return *this;
// }
// //重载后置++
// Complex operator++(int)
// {
// Complex temp;
// temp.a = this->a;
// temp.b = this->b;
// a++;
// b++;
// return temp;
// }
//private:
// int a;
// int b;
//};
//
//int main()
//{
// Complex c;
// cout << ++c << endl;//前置++
// //cout << c++ << endl;//后置++
// return 0;
//}
//#include<iostream>
//using namespace std;
//
//class A
//{
//public:
// A(int a)
// :_a1(a)
// , _a2(_a1)
// {}
// void Print() {
// cout << _a1 << " " << _a2 << endl;
// }
//private:
// int _a2;
// int _a1;
//};
//int main() {
// A aa(1);
// aa.Print();
//}
//#include<iostream>
//using namespace std;
//int main()
//{
//
//}
////#/*include<stdio.h>
//struct s1
//{
// int a;
// char c1;
//
// char c2;
//};
//int main()
//{
// s1 s1;
// printf("%d \n", sizeof(s1));
// return 0;
//}*/
//
//#include<iostream>
//using namespace std;
//int main()
//{
//
//}
//
//#include<stdio.h>
//#pragma pack(1)//修改默认对齐数
//struct s
//{
// char i;
// int a;
// char j;
//};
//#pragma pack()//表示修改结束
//int main()
//{
// struct s a1;
// printf("%d\n", sizeof(a1));
// return 0;
//}
////位段
//#include<stdio.h>
//struct A
//{
// int _a : 2;//两个比特位
// int _b : 5;
// int _c : 10;
// int _d : 30;
//};
//int main()
//{
// printf("%d\n", sizeof(struct A));
// return 0;
//}
//#include<stdio.h>
//union s
//{
// char i;
// int a;
//};
//int main()
//{
// union s s1;
// s1.i = 0x11223344;
// s1.a = 0x55;
// printf("%x", s1);
//}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/lxkeepcoding/codingone.git
git@gitee.com:lxkeepcoding/codingone.git
lxkeepcoding
codingone
codingone
master

搜索帮助