007 Array Tutorial01

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

IPEKAINTERNATIONALCHRISTIANSCHOOL MERUYA C++PROGRAMMINGINTERMEDIATE ARRAY_Tutorial_01 DATE:___________________ NAME:_____________________

DevelopingC++Program [16marks]

1. WriteaC++programthatpromptsuserforeachinputinanintarrayofsize5. Displaytheelementsinthearrayintheorderuserinputsandinreverseorder. Sampleofoutput:

MarkingCriteria[8 marks]
1.Programprovidescommunicationthatisunderstandabletouser. 2.Programaccepts5inputsfromtheuser. 3.Programusesarray. 4.Programdisplayselementsofarrayintheordertheywereentered. 5.Programdisplayselementsofarrayinreverseorder. 6.Programusesfunctionstoallowusertoinputusesfunctionstodisplay. 7.Programusesfunctionstodisplaythearray. 8.Programusesfunctionstodisplaythearrayinreverseorder.

2. Linearsearchisamethodusedtofindanelementinalistofarrayelements.Itworksby comparingeachoftheelementswiththesearchitem. CreateaC++programthatallowsuserto: input10numbersasthearrayelements, sortsthenumbersinascendingorder, sortsthenumbersindescendingorder, promptsuserforanumbertobesearched, displaysthesearchresult, allowsusertochangeelementsinthearray, promptsuserifinputisinvalidand allowsusertorepeattheprogram. MarkingCriteria [10marks]
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Programprovidescommunicationthatisunderstandabletouser. Programusesfunctiontodisplaymenu. Programacceptsaninputandcallsthefunctionthatrepresentsthefunction. Functiontosortinascendingorderworkscorrectly. Functiontosortindescendingorderworkscorrectly. Functiontosearchanelementworkscorrectly. Functiontochangeanelementworkscorrectly. Functiontodisplayanelementworkscorrectly. Programkeepsonrepeatinguntiluserpromptstoquit. Functionthatpromptsvalidinputworkscorrectly.

SampleofOutputonthefollowingpage

Sampleofoutput:(Redboxindicatessampleofinput)

EndofQuestions

You might also like