Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

%3Cp%20class%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%2

ID: 3550251 • Letter: #

Question

%3Cp%20class%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E%3Cb%3E1.%26nbsp%3BThis%26nbsp%3Bexercise%26nbsp%3Bis%26nbsp%3Babout%26nbsp%3Bto%26nbsp%3Bone%26nbsp%3Bdimensional%26nbsp%3Barrays%2C%26nbsp%3Bfunctions%2C%26nbsp%3Band%26nbsp%3Bfile%26nbsp%3Boperations.%3C%2Fb%3E%3C%2Fspan%3E%3Cb%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fb%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E(a)%26nbsp%3BWrite%26nbsp%3Ba%26nbsp%3Bfunction%26nbsp%3Bcalled%26nbsp%3B%3Cstrong%3EreadFromFileToArray%3C%2Fstrong%3E%26nbsp%3Bthat%26nbsp%3Bwill%26nbsp%3Bhave%26nbsp%3Bthree%26nbsp%3Bformal%26nbsp%3Bparameters%3A%26nbsp%3Ban%26nbsp%3Binput%26nbsp%3Bfile%26nbsp%3Bstream%2C%26nbsp%3Ban%26nbsp%3Binteger%26nbsp%3Barray%2C%26nbsp%3Band%26nbsp%3Bsize%26nbsp%3Bof%26nbsp%3Bthe%26nbsp%3Binteger%26nbsp%3Barray.%26nbsp%3BThe%26nbsp%3Bfunction%26nbsp%3Bwill%26nbsp%3Bread%26nbsp%3Ball%26nbsp%3Bthe%26nbsp%3Bintegers%26nbsp%3Bfrom%26nbsp%3Ba%26nbsp%3Btext%26nbsp%3Bfile%26nbsp%3Binto%26nbsp%3Bthe%26nbsp%3Barray.%26nbsp%3BThe%26nbsp%3Barray%26nbsp%3Bsize%26nbsp%3Bwill%26nbsp%3Balso%26nbsp%3Bbe%26nbsp%3Bupdated%26nbsp%3Bby%26nbsp%3Bthe%26nbsp%3Bfunction.%26nbsp%3BThat%26nbsp%3Bis%26nbsp%3Bthe%26nbsp%3Bfunction%26nbsp%3Bprototype%26nbsp%3Bwill%26nbsp%3Blook%26nbsp%3Blike%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B153%2C%26nbsp%3B102)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23339966%3B%22%3E%3Cb%3Evoid%26nbsp%3BreadFromFiletoArray(ifstream%26nbsp%3B%26amp%3Binf%2C%26nbsp%3Bint%26nbsp%3BtheArray%5B%5D%2C%26nbsp%3Bint%26nbsp%3B%26amp%3BarraySize)%3B%3C%2Fb%3E%3C%2Fspan%3E%3Cb%3E%3Cspan%26nbsp%3Bstyle%3D%22font-size%3A%26nbsp%3B12pt%3B%26nbsp%3Bcolor%3A%26nbsp%3Brgb(0%2C%26nbsp%3B176%2C%26nbsp%3B80)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22font-size%3A%26nbsp%3B12pt%3B%26nbsp%3Bcolor%3A%26nbsp%3B%2300b050%3B%22%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fspan%3E%3C%2Fb%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3EAlso%2C%26nbsp%3Bwrite%26nbsp%3Bcode%26nbsp%3Bin%26nbsp%3Byour%26nbsp%3Bmain%26nbsp%3Bprogram%26nbsp%3Bto%26nbsp%3Btest%26nbsp%3Byour%26nbsp%3Bfunction%26nbsp%3B(hint%3A%26nbsp%3Byou%26nbsp%3Bwill%26nbsp%3Bneed%26nbsp%3Bto%26nbsp%3Bcreate%26nbsp%3Bvarious%26nbsp%3Btext%26nbsp%3Bfiles%26nbsp%3Bwith%26nbsp%3Bdifferent%26nbsp%3Bnumber%26nbsp%3Bof%26nbsp%3Bintegers%26nbsp%3Bin%26nbsp%3Bthem%26nbsp%3Band%26nbsp%3Balso%26nbsp%3Bneed%26nbsp%3Bto%26nbsp%3Bhave%26nbsp%3Banother%26nbsp%3Bfunction%26nbsp%3Bto%26nbsp%3Bprint%26nbsp%3Bthe%26nbsp%3Barray).%26nbsp%3BSave%26nbsp%3Byour%26nbsp%3Bprogram%26nbsp%3Bas%26nbsp%3Blab2-1a-yourName.cpp%26nbsp%3Band%26nbsp%3Bsubmit.%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E(b)%26nbsp%3B(optional)%26nbsp%3BFor%26nbsp%3Bextra%26nbsp%3Bfun%26nbsp%3Band%26nbsp%3Bchallenge%3A%26nbsp%3BWrite%26nbsp%3Ba%26nbsp%3Bfunction%26nbsp%3Bcalled%3Cstrong%3E%26nbsp%3BwriteFromArrayToFile%3C%2Fstrong%3E%26nbsp%3Bthat%26nbsp%3Bwill%26nbsp%3Bhave%26nbsp%3Bthree%26nbsp%3Bformal%26nbsp%3Bparameters%3A%26nbsp%3Ban%26nbsp%3Boutput%26nbsp%3Bfile%26nbsp%3Bstream%2C%26nbsp%3Ban%26nbsp%3Binteger%26nbsp%3Barray%2C%26nbsp%3Band%26nbsp%3Bsize%26nbsp%3Bof%26nbsp%3Bthe%26nbsp%3Binteger%26nbsp%3Barray.%26nbsp%3BThe%26nbsp%3Bfunction%26nbsp%3Bwill%26nbsp%3Bwrite%26nbsp%3Ball%26nbsp%3Bthe%26nbsp%3Bintegers%26nbsp%3Bin%26nbsp%3Bthe%26nbsp%3Barray%26nbsp%3Binto%26nbsp%3Bthe%26nbsp%3Btext%26nbsp%3Bfile.%26nbsp%3BThat%26nbsp%3Bis%26nbsp%3Bthe%26nbsp%3Bfunction%26nbsp%3Bprototype%26nbsp%3Bwill%26nbsp%3Blook%26nbsp%3Blike%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B153%2C%26nbsp%3B102)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23339966%3B%22%3E%3Cb%3Evoid%26nbsp%3BwriteFromArraytoFile(ofstream%26nbsp%3B%26amp%3Boutf%2C%26nbsp%3Bconst%26nbsp%3Bint%26nbsp%3BtheArray%5B%5D%2C%26nbsp%3Bint%26nbsp%3BarraySize)%3B%3C%2Fb%3E%3C%2Fspan%3E%3Cb%3E%3Cspan%26nbsp%3Bstyle%3D%22font-size%3A%26nbsp%3B12pt%3B%26nbsp%3Bcolor%3A%26nbsp%3Brgb(0%2C%26nbsp%3B176%2C%26nbsp%3B80)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22font-size%3A%26nbsp%3B12pt%3B%26nbsp%3Bcolor%3A%26nbsp%3B%2300b050%3B%22%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fspan%3E%3C%2Fb%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3EAlso%2C%26nbsp%3Bwrite%26nbsp%3Bcode%26nbsp%3Bin%26nbsp%3Byour%26nbsp%3Bmain%26nbsp%3Bprogram%26nbsp%3Bto%26nbsp%3Btest%26nbsp%3Byour%26nbsp%3Bfunction.%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cbr%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E%3Cb%3E2.%26nbsp%3BThis%26nbsp%3Bexercise%26nbsp%3Bis%26nbsp%3Babout%26nbsp%3Bone%26nbsp%3Bdimensional%26nbsp%3Barrays%26nbsp%3Band%26nbsp%3Bfunctions.%3C%2Fb%3E%3C%2Fspan%3E%3Cb%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fb%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E(a)%26nbsp%3BWrite%26nbsp%3Ba%26nbsp%3Bfunction%26nbsp%3Bcalled%26nbsp%3B%3Cstrong%3EsmallestIndex%3C%2Fstrong%3E%2C%26nbsp%3Bthat%26nbsp%3Btakes%26nbsp%3Bas%26nbsp%3Bformal%26nbsp%3Bparameters%26nbsp%3Ban%26nbsp%3Bint%26nbsp%3Barray%26nbsp%3Band%26nbsp%3Bits%26nbsp%3Bsize%26nbsp%3Band%26nbsp%3Breturns%26nbsp%3Bthe%26nbsp%3Bindex%26nbsp%3Bof%26nbsp%3Bthe%26nbsp%3Bfirst%26nbsp%3Boccurance%26nbsp%3Bof%26nbsp%3Bthe%26nbsp%3Bsmallest%26nbsp%3Belement%26nbsp%3Bin%26nbsp%3Bthe%26nbsp%3Barray.%26nbsp%3BAfter%26nbsp%3Bwriting%26nbsp%3Byour%26nbsp%3Bfunction%2C%26nbsp%3Bwrite%26nbsp%3Bfunction%26nbsp%3Bcalls%26nbsp%3Bin%26nbsp%3Bthe%26nbsp%3Bmain%26nbsp%3Bprogram%26nbsp%3Bto%26nbsp%3Btest%26nbsp%3Byour%26nbsp%3Bfunction%26nbsp%3Bwith%26nbsp%3Bvarious%26nbsp%3Btest%26nbsp%3Bcases.%26nbsp%3BSave%26nbsp%3Byour%26nbsp%3Bprogram%26nbsp%3Bas%26nbsp%3Blab2-2-yourName.cpp%26nbsp%3Band%26nbsp%3Bsubmit.%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E(b)%26nbsp%3B(optional)%26nbsp%3BFor%26nbsp%3Bextra%26nbsp%3Bfun%26nbsp%3Band%26nbsp%3Bchallenge%3A%26nbsp%3BWrite%26nbsp%3Ba%26nbsp%3Bfunction%26nbsp%3Bcalled%26nbsp%3B%3Cstrong%3EsmallestOrBiggestIndex%3C%2Fstrong%3E%2C%26nbsp%3Bthat%26nbsp%3Btakes%26nbsp%3Bas%26nbsp%3Bformal%26nbsp%3Bparameters%26nbsp%3Ban%26nbsp%3Bint%26nbsp%3Barray%2C%26nbsp%3Bits%26nbsp%3Bsize%2C%26nbsp%3Band%26nbsp%3Ba%26nbsp%3Bboolean%26nbsp%3Boption.%26nbsp%3BIf%26nbsp%3Bthe%26nbsp%3Boption%26nbsp%3Bis%26nbsp%3Btrue%2C%26nbsp%3Bthe%26nbsp%3Bfunction%26nbsp%3Bwill%26nbsp%3Breturn%26nbsp%3Bthe%26nbsp%3Bindex%26nbsp%3Bof%26nbsp%3Bthe%26nbsp%3Bfirst%26nbsp%3Boccurance%26nbsp%3Bof%26nbsp%3Bthe%26nbsp%3Bsmallest%26nbsp%3Belement%26nbsp%3Bin%26nbsp%3Bthe%26nbsp%3Barray.%26nbsp%3BIf%26nbsp%3Bthe%26nbsp%3Boption%26nbsp%3Bis%26nbsp%3Bfalse%2C%26nbsp%3Bthe%26nbsp%3Bfunction%26nbsp%3Bwill%26nbsp%3Breturn%26nbsp%3Bthe%26nbsp%3Bindex%26nbsp%3Bof%26nbsp%3Bthe%26nbsp%3Bfirst%26nbsp%3Boccurance%26nbsp%3Bof%26nbsp%3Bthe%26nbsp%3Bbiggest%26nbsp%3Belement%26nbsp%3Bin%26nbsp%3Bthe%26nbsp%3Barray.%26nbsp%3BAfter%26nbsp%3Bfinishing%26nbsp%3Byour%26nbsp%3Bfunction%2C%26nbsp%3Bwrite%26nbsp%3Bfunction%26nbsp%3Bcalls%26nbsp%3Bin%26nbsp%3Bthe%26nbsp%3Bmain%26nbsp%3Bprogram%26nbsp%3Bto%26nbsp%3Btest%26nbsp%3Byour%26nbsp%3Bfunction%26nbsp%3Bwith%26nbsp%3Bvarious%26nbsp%3Btest%26nbsp%3Bcases.%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cbr%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E%3Cb%3E3.%26nbsp%3BThis%26nbsp%3Bexercise%26nbsp%3Bis%26nbsp%3Babout%26nbsp%3Bone%26nbsp%3Bdimensional%26nbsp%3Barrays%26nbsp%3Band%26nbsp%3Bfile%26nbsp%3Boperations.%3C%2Fb%3E%3C%2Fspan%3E%3Cb%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fb%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bfont-size%3A%26nbsp%3B13px%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3EWrite%26nbsp%3Ba%26nbsp%3Bprogram%26nbsp%3Bthat%26nbsp%3Breads%26nbsp%3Ba%26nbsp%3Btext%26nbsp%3Bfile%26nbsp%3B(input.txt)%26nbsp%3Bconsisting%26nbsp%3Bof%26nbsp%3Bstudents%C3%A2%EF%BF%BD%EF%BF%BD%26nbsp%3Btest%26nbsp%3Bscores%26nbsp%3Bin%26nbsp%3Bthe%26nbsp%3Brange%26nbsp%3B0%C3%A2%EF%BF%BD%EF%BF%BD%26nbsp%3B200.%26nbsp%3BIt%26nbsp%3Bshould%26nbsp%3Bthen%26nbsp%3Bdetermine%26nbsp%3Bthe%26nbsp%3Bnumber%26nbsp%3Bof%26nbsp%3Bstudents%26nbsp%3Bhaving%26nbsp%3Bscores%26nbsp%3Bin%26nbsp%3Beach%26nbsp%3Bof%26nbsp%3Bthe%26nbsp%3Bfollowing%26nbsp%3Branges%3A%26nbsp%3B0%C3%A2%EF%BF%BD%EF%BF%BD%26nbsp%3B50%2C%26nbsp%3B51%C3%A2%EF%BF%BD%EF%BF%BD%26nbsp%3B100%2C%26nbsp%3B101%C3%A2%EF%BF%BD%EF%BF%BD%26nbsp%3B150%2C%26nbsp%3B151-200.%26nbsp%3BOutput%26nbsp%3Bthe%26nbsp%3Bscore%26nbsp%3Branges%26nbsp%3Band%26nbsp%3Bthe%26nbsp%3Bnumber%26nbsp%3Bof%26nbsp%3Bstudents.%26nbsp%3BSee%26nbsp%3Bthe%26nbsp%3Bexample%26nbsp%3Bbelow.%26nbsp%3BSave%26nbsp%3Byour%26nbsp%3Bprogram%26nbsp%3Bas%26nbsp%3Blab3-1-yourName.cpp%26nbsp%3Band%26nbsp%3Bsubmit.%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Ctable%26nbsp%3Bclass%3D%22MsoTableGrid%22%26nbsp%3Bborder%3D%221%22%26nbsp%3Bcellspacing%3D%220%22%26nbsp%3Bcellpadding%3D%220%22%26nbsp%3Bstyle%3D%22font-size%3A%26nbsp%3B13px%3B%26nbsp%3Bcolor%3A%26nbsp%3Brgb(51%2C%26nbsp%3B51%2C%26nbsp%3B51)%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bborder-collapse%3A%26nbsp%3Bcollapse%3B%26nbsp%3Bborder%3A%26nbsp%3Bnone%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22font-size%3A%26nbsp%3B13px%3B%26nbsp%3Bcolor%3A%26nbsp%3B%23333333%3B%26nbsp%3Bfont-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bborder-collapse%3A%26nbsp%3Bcollapse%3B%26nbsp%3Bborder%3A%26nbsp%3Bnone%3B%22%3E%3Ctbody%3E%3Ctr%3E%3Ctd%26nbsp%3Bwidth%3D%22319%22%26nbsp%3Bvalign%3D%22top%22%26nbsp%3Bstyle%3D%22font-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bwidth%3A%26nbsp%3B239.4pt%3B%26nbsp%3Bborder%3A%26nbsp%3B1pt%26nbsp%3Bsolid%26nbsp%3Bwindowtext%3B%26nbsp%3Bpadding%3A%26nbsp%3B0in%26nbsp%3B5.4pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22font-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bwidth%3A%26nbsp%3B239.4pt%3B%26nbsp%3Bborder%3A%26nbsp%3B1pt%26nbsp%3Bsolid%26nbsp%3Bwindowtext%3B%26nbsp%3Bpadding%3A%26nbsp%3B0in%26nbsp%3B5.4pt%3B%22%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3EContent%26nbsp%3Bof%26nbsp%3Binput.txt%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cbr%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E51%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E55%26nbsp%3B100%26nbsp%3B120%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E130%26nbsp%3B200%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E140%26nbsp%3B155%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E160%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3C%2Ftd%3E%3Ctd%26nbsp%3Bwidth%3D%22234%22%26nbsp%3Bvalign%3D%22top%22%26nbsp%3Bstyle%3D%22font-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bwidth%3A%26nbsp%3B175.5pt%3B%26nbsp%3Bborder-style%3A%26nbsp%3Bsolid%26nbsp%3Bsolid%26nbsp%3Bsolid%26nbsp%3Bnone%3B%26nbsp%3Bborder-top-color%3A%26nbsp%3Bwindowtext%3B%26nbsp%3Bborder-right-color%3A%26nbsp%3Bwindowtext%3B%26nbsp%3Bborder-bottom-color%3A%26nbsp%3Bwindowtext%3B%26nbsp%3Bborder-top-width%3A%26nbsp%3B1pt%3B%26nbsp%3Bborder-right-width%3A%26nbsp%3B1pt%3B%26nbsp%3Bborder-bottom-width%3A%26nbsp%3B1pt%3B%26nbsp%3Bpadding%3A%26nbsp%3B0in%26nbsp%3B5.4pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22font-family%3A%26nbsp%3BTahoma%2C%26nbsp%3BVerdana%2C%26nbsp%3BArial%2C%26nbsp%3BHelvetica%2C%26nbsp%3Bsans-serif%3B%26nbsp%3Bwidth%3A%26nbsp%3B175.5pt%3B%26nbsp%3Bborder-style%3A%26nbsp%3Bsolid%26nbsp%3Bsolid%26nbsp%3Bsolid%26nbsp%3Bnone%3B%26nbsp%3Bborder-top-color%3A%26nbsp%3Bwindowtext%3B%26nbsp%3Bborder-right-color%3A%26nbsp%3Bwindowtext%3B%26nbsp%3Bborder-bottom-color%3A%26nbsp%3Bwindowtext%3B%26nbsp%3Bborder-top-width%3A%26nbsp%3B1pt%3B%26nbsp%3Bborder-right-width%3A%26nbsp%3B1pt%3B%26nbsp%3Bborder-bottom-width%3A%26nbsp%3B1pt%3B%26nbsp%3Bpadding%3A%26nbsp%3B0in%26nbsp%3B5.4pt%3B%22%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3EYour%26nbsp%3Bscreen%26nbsp%3Boutput%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cbr%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3ERanges%26nbsp%3BCount%26nbsp%3B%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E0-50%26nbsp%3B0%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E51-100%26nbsp%3B3%26nbsp%3B%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E101-150%26nbsp%3B3%26nbsp%3B%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cp%26nbsp%3Bclass%3D%22MsoNormal%22%26nbsp%3Bstyle%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22margin-bottom%3A%26nbsp%3B0.0001pt%3B%22%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E151-200%26nbsp%3B3%3C%2Fspan%3E%3Co%3Ap%3E%3C%2Fo%3Ap%3E%3C%2Fp%3E%3Cdiv%3E%3Cspan%26nbsp%3Bstyle%3D%22color%3A%26nbsp%3Brgb(0%2C%26nbsp%3B0%2C%26nbsp%3B255)%3B%26nbsp%3B%22%26nbsp%3Bdata-mce-style%3D%22color%3A%26nbsp%3B%230000ff%3B%22%3E%3Cbr%3E%3C%2Fspan%3E%3C%2Fdiv%3E%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Ftbody%3E%3C%2Ftable%3E

Explanation / Answer

//(a) Write a function called readFromFileToArray that will have three formal parameters:
//an input file stream, an integer array, and size of the integer array. The function will read all the integers from a text file into the array.
//The array size will also be updated by the function. That is the function prototype will look like

#include<iostream>
#include<fstream>
using namespace std;
void readFromFiletoArray(ifstream &inf, int theArray[], int &arraySize)
{
arraySize = 0;
while(!inf.eof())
{
inf >> theArray[arraySize++];
}
}

//(b) (optional) For extra fun and challenge: Write a function called writeFromArrayToFile that will have three formal parameters:
//an output file stream, an integer array, and size of the integer array. The function will write all the integers in the array into
//the text file. That is the function prototype will look like

void writeFromArraytoFile(ofstream &outf, const int theArray[], int arraySize)
{
for(int i=0; i<arraySize; i++)
outf << theArray[i] << " ";
outf << endl;
}

int main()
{
ifstream inf("input.txt");
ofstream outf("output.txt");
int array[1000];
int size;
if(!inf)
{
cout <<"unable to open file input.txt. so exiting from program ";
return 0;
}
readFromFiletoArray(inf,array,size);
writeFromArraytoFile(outf,array,size);
for(int i=0; i<size; i++)
cout << array[i] <<" ";
cout << endl;
return 0;
}


//(a) Write a function called smallestIndex, that takes as formal parameters an int array and its size and returns the index of the
//first occurance of the smallest element in the array. After writing your function, write function calls in the main program to test
// your function with various test cases. Save your program as lab2-2-yourName.cpp and submit.

#include<iostream>
using namespace std;
int smallestIndex(const int array[],int size)
{
int min_index = 0;
for(int i=1; i<size; i++)
{
if(array[i] < array[min_index]) min_index = i;
}
return min_index;
}

//(b) (optional) For extra fun and challenge: Write a function called smallestOrBiggestIndex, that takes as formal parameters an int array,
//its size, and a boolean option. If the option is true, the function will return the index of the first occurance of the smallest element
//in the array. If the option is false, the function will return the index of the first occurance of the biggest element in the array.
//After finishing your function, write function calls in the main program to test your function with various test cases.
int smallestOrBiggestIndex(const int array[], int size, bool is_big_or_small)
{
int index = 0;
if(is_big_or_small)
{
for(int i=1; i<size; i++)
{
if(array[i] < array[index]) index = i;
}
return index;
}
else
{
for(int i=1; i<size; i++)
{
if(array[i] > array[index]) index = i;
}
return index;
}
}

int main()
{
int array[] = { 3 , 4 , 1, 2 , 5,6,7,1};
cout <<"element found at " << smallestOrBiggestIndex(array,8,false) << endl;
return 0;
}


//Write a program that reads a text file (input.txt) consisting of students test scores in the range 0 200. It should then determine
//the number of students having scores in each of the following ranges: 0 50, 51 100, 101 150, 151-200. Output the score
//ranges and the number of students. See the example below. Save your program as lab3-1-yourName.cpp and submit.


#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream inf("input.txt");
int array[1000];
int size;
if(!inf)
{
cout <<"unable to open file input.txt. so exiting from program ";
return 0;
}
size = 0;
while(!inf.eof())
{
inf >> array[size++];
}
int a[4] = {0};
for(int i=0; i<size; i++)
{
if(array[i]>=0 && array[i]<=50) a[0]++;
else if(array[i]>=51 && array[i]<=100) a[1]++;
else if(array[i]>=101 && array[i]<=150) a[2]++;
else if(array[i]>=151 && array[i]<=200) a[3]++;
}
cout <<"Ranges   Count " << endl;
cout <<"0-50      " << a[0] << endl;
cout <<"51-100    " << a[1] << endl;
cout <<"101-150   " << a[2] << endl;
cout <<"151-200   " << a[3] << endl;

return 0;
}