
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
help with c++...paste indented code plzz
![Q1:, ., Implement a range function for a dynamic array which returns a new
dynamic array that is a subset of the original.
input parameters: array - (the array and any related parameters)
start - index of the first element
end - index of the last element
Interval - An integer number specifying the incrementation of index
This function returns a new dynamic array containing the elements from the start thru
the end indices of the original array.
All array indexing must be done using pointer arithmetic.
For example, given the array:
49 96 99 47 76 29 22 16 30 22
If the start and end positions were 5 and 9 with step 2, return a new dynamic array:
29 16 22
Please use following main to test your function.
int main(){
int *p = new int[10]{49,96,99,47,76,29,22,16,30,22};
int *q = range(p,10,5,9,2);
for(int i=0;i<3;i++)
cout<<q[i]<<" "; // print 29 16 22
cout<<endl;
delete [] q;
q = range(p,10,1,8,3);
for(int i=0;i<3;i++)
cout<<q[i]<<" "; // print 96 76 16
cout<<endl;
delete [] q;
}
%3D
%3D](https://content.bartleby.com/qna-images/question/e0c0eda2-521b-4eab-8782-362c8a1f5d1a/8134323b-d482-4454-9466-9f26026d2af8/9l5dzrd_thumbnail.png)
Transcribed Image Text:Q1:, ., Implement a range function for a dynamic array which returns a new
dynamic array that is a subset of the original.
input parameters: array - (the array and any related parameters)
start - index of the first element
end - index of the last element
Interval - An integer number specifying the incrementation of index
This function returns a new dynamic array containing the elements from the start thru
the end indices of the original array.
All array indexing must be done using pointer arithmetic.
For example, given the array:
49 96 99 47 76 29 22 16 30 22
If the start and end positions were 5 and 9 with step 2, return a new dynamic array:
29 16 22
Please use following main to test your function.
int main(){
int *p = new int[10]{49,96,99,47,76,29,22,16,30,22};
int *q = range(p,10,5,9,2);
for(int i=0;i<3;i++)
cout<<q[i]<<" "; // print 29 16 22
cout<<endl;
delete [] q;
q = range(p,10,1,8,3);
for(int i=0;i<3;i++)
cout<<q[i]<<" "; // print 96 76 16
cout<<endl;
delete [] q;
}
%3D
%3D
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 4 images

Knowledge Booster
Similar questions
- Explain what is palindrome and write a code to check whether the given string is palindrome or not? write the code with proper explaination in C++ language.arrow_forwardList two features we used from the C++ standard library, including a short explanation of why you would use the feature and which header file must be included. Example: The std::cin object is found in the iostream header file and is used to read characters from the keyboard.arrow_forwardstring is a primitive type of C++ True Falsearrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY