这四道C++题目有没有人会做啊····求解
1.Writeafunctionprint()thatprintsavectorofintstocout.Giveittwoarguments:astringfor"labeling"theoutputandavector.
2.CreateavectorofFibonaccinumbersandprintthemusingthefunctionfromexercise1.Tocreatethevector,writeafunction,fibonacci(x,y,v,n),whereintegersxandyareints,visanemptyvector,andnisthenumberofelementstoputintov;v[0]willbexandv[1]willbey.AFibonaccinumberisonethatispartofasequencewhereeachelementisthesumofthetwopreviousones.Forexample,startingwith1and1,weget1,1,2,3,5,8,13,21,34,55,89,144,233…..Yourfibonacci()functionshouldmakesuchaseriesstartingwithitsxandyarguments.
3.Writetwofunctionsthatreversetheorderofelementsinavector.Forexample,1,3,5,7,9becomes9,7,5,3,1.Thefirstreversefunctionshouldproduceanewvectorwiththereversedsequence,leavingitsoriginalvectorunchanged.Theotherreversefunctionshouldreversetheelementsofitsvectorwithoutusinganyothervectors(hint:swap).
4.Hereisanothermathematicalproblem,wherethetrickisasmuchtodiscoverthealgorithmasitistowritethecode:writeaprogramtodisplayallpossiblepermutationsofagiveninputstring--ifthestringcontainsduplicatecharacters,youmayhavemultiplerepeatedresults.Inputshouldbeoftheformpermutestringandoutputshouldbeawordperline.
Hereisasamplefortheinput“cat”:
cat
cta
act
atc
tac
tca