![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Please Help!!!! write in c++ language
![Write C++ code to create a function called shift that solves the problem below (see
end of problem for the shift function header definition):
You have a pointer to an array with N elements where N is any real number.
• The starting array could look similar to this: 3, 5, 1, 9.3 where the
underscores are unused index positions in the array.
Shift the elements to the right one slot so that all numbers from the index
position of the array are shifted to the right. This leaves a "gap" where the
index position currently is and fills the gap at the end of the array.
This is one example of how the array could look after your code runs,
depending on the index value passed into the function: 3, 5, 1, 9,3
Your code should work with an array that contains more or fewer elements,
but the capacity will always have two open slots at the end of the array, as
shown above.
After the shift, set the value at the gap (or opened) slots to insertValue1 and
insertValue2, respectively.
Do not create any other arrays or vectors, write any other functions, or use
concepts/constructs not taught in the course.
You must use the function header/signature below. Complete the function below:
void shift(int index, int *ptrArray, int capacity, insertValue1, insertValue2) {](https://content.bartleby.com/qna-images/question/a111771e-e949-4a6c-a45c-ebe5661b4ed0/694dfdae-ec5f-46e1-91a5-daba8b492597/nognbl_thumbnail.jpeg)
Transcribed Image Text:Write C++ code to create a function called shift that solves the problem below (see
end of problem for the shift function header definition):
You have a pointer to an array with N elements where N is any real number.
• The starting array could look similar to this: 3, 5, 1, 9.3 where the
underscores are unused index positions in the array.
Shift the elements to the right one slot so that all numbers from the index
position of the array are shifted to the right. This leaves a "gap" where the
index position currently is and fills the gap at the end of the array.
This is one example of how the array could look after your code runs,
depending on the index value passed into the function: 3, 5, 1, 9,3
Your code should work with an array that contains more or fewer elements,
but the capacity will always have two open slots at the end of the array, as
shown above.
After the shift, set the value at the gap (or opened) slots to insertValue1 and
insertValue2, respectively.
Do not create any other arrays or vectors, write any other functions, or use
concepts/constructs not taught in the course.
You must use the function header/signature below. Complete the function below:
void shift(int index, int *ptrArray, int capacity, insertValue1, insertValue2) {
Expert Solution
![Check Mark](/static/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 1 images
![Blurred answer](/static/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- I am having trouble running the code, it says there are a lot of errors and I am not sure I am even running it right. How would I go about running the code and fixing the errors in C++arrow_forwardUsing C# program explain step by step using your code how can we reverse the string. Dont forgot to put the comments with proper explainationarrow_forwardWhen we are talking about c++ and our code, what does reusability mean? Please explain in detail thanksarrow_forward
- In the C# computer language, what is the main difference between non-static, static, read-only, and constant variables?arrow_forwardChapter 1- Discussion - What makes C++ so popular! What makes C++ so popular! I am sure you all have had various reasons to take this C++ course. After reading chapter 1, you must have realized how vast impact C++ programming language has caused on our daily lives. Many of the programming languages that we use actually derive from C++. C++ is probably considered the first modern Object Oriented Programming lanuguage. The discussion question I have you all for this week is; What makes C++ so popular?arrow_forwardWhat is __init__() in Python?arrow_forward
- In creating C++ applications, you have the ability to utilize various formatting functions in the iostream library. What are some of the formatting vulnerabilities that can be encountered in using the iostream library in C++? What tips can be utilized to identify these vulnerabilities? Be sure to provide an appropriate source code example to illustrate your points.arrow_forwardHello, I would appreciate if this code be written in C++.arrow_forwardI am learning c++ right now, and I am confused about the rand() command. Please explain this to me, and give me an example and how to use it. Thank you.arrow_forward
- How might understanding data types help prevent some common bugs in your code in python?150 to 300 words please.arrow_forwardTrying to update a C++ code I wrote earlier (perhaps around 30-60 lines of code) and make it compile and run showing how to use: Note: I am currently working on using class. I am not commited to the below code, just looking for a job example to help me understand the concepts better and how to clean up my own code to be more effiecent using the current items I am reading about. I would like to stay using the address example though. Please label code to help me understand as I break it down. a. abstract data type b. const c. class constructor #include <iostream>#include <string> using namespace std; class address // address structure type{public:string streetAddress;string city;string state;int zipcode; }; int main() { address guest; // class address named guest address home; // class adress named home and inputshome.streetAddress = "1234 Right Way Rd.";home.city = "Huntsville";home.state = "AL";home.zipcode = 35803; cout << "What is your address?…arrow_forwardIn C#, how do you make a Windows service?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
![Text book image](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
![Text book image](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
![Text book image](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
![Text book image](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
![Text book image](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education