In PHP I remember I can do something like
substr(string,start,length)
now I declare
int array[20];
how can I print only a part of it without using a for loop
for example.
cout << array[1 to 5] << "Here is the breaking point" << array[15 to 20] << endl;
Something like this
I also remember if it was printf there would be something like ^5 or something like saying upto 5
You can use a combination of
ostream_iteratorandcopy(link to ideone):The
array+3syntax may look unusual: this is a pointer expression equivalent to&array[3], which produces a pointer. Since you can pass a pair of array pointers where C standard library expects a pair of iterators, this produces the expected results.