The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 4 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
In C++, there is no check to determine whether the array index is out of bounds. During program execution, an out-of-bound array index can cause serious problems. Also, recall that in C++ the array index starts at 0.
Design a class safeArray that solves the out-of-bound array index problem and allows the user to begin the array index starting at any integer, positive or negative. Every object of type safeArray should be an array of type int. During execution, when accessing an array component, if the index is out of bounds, the program must terminate with an appropriate
error message. For example,
safeArray list(2,13);
safeArray yourList(-5,9);
In this example, list is an array of 11 components, the component type is
int, and the components are list[2], list[3], ..., list[12]. Also,
yourList is an array of 15 components, the component type is int, and the
components are yourList[-5], yourlist[-4], ..., yourList[0], ...,
yourList[8].
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------sol-----------uti-----------on.-----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- ca-----------tch-----------