Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We also need to implement the main function and a print function to test these three functions. Pwease help. /* This program requires the student
We also need to implement the main function and a print function to test these three functions. Pwease help. /* This program requires the student to write 3 functions described in * Program project 4 (Page 535) and Program Project 6 (Page 536). * The student also need to add a print function to print out an array. * The student may watch video notes on MyProgrammingLab to get the idea * on how to write the main function and three of these four functions * * Author: Your Name * Version: The date */ #include#include #include using namespace std; void reverse(char* front, char* rear); // Precondition: The front and rear are pointing to the front // and rear of a C-string, respectively // Postcondition: The C-string is reversed string* addEntry(string* dynamiccArray, int& size, string newEntry); // Precondition: dynamicArray point to a array of strings with give size, // newEntry is a string // Postcondition: A new dynamic array is created, which is one larger than // dynamicArray All elements from dynamicArray are copied to // new array, the new entry is added to new array, the size // is increased, the dynamicArray is deleted, new dynamic // array is returned. string* deleteEntry(string* dynamicArray, int& size, string entryToDelete); // Precondition: dynamicArray point to a array of strings with give size, // newEntry is a string // Postcondition: The function should search dynamicArray for entryToDelete. // If not found, the request should be ignored and the // unmodified dynamicArray returned. If found, create a new // dynamic array one element smaller than dynamicArray. Copy // all element except entryToDelete into the new array, delete // dynamicArray, decrement size, and return the new dynamic // array void print(const string* dynamicArray, int size); // Precondition: dynamicArray point to a array of strings with give size, // Postcondition: The elements in dynamic array will be print out. One // element per line forllowed by its index int main() { // write code to test reverse function. // make sure that you test it on at least two strings // one string has even length, another string has odd length // write code to test add entry and delete entry function // you may watch video notes to get idea for this part return 0; } void reverse(char* front, char* rear) { // you implement this. Please read Programming Project 4 on page 535 } string* addEntry(string* dynamicArray, int& size, string newEntry) { // you implement this. Please read Programming Project 6 on page 536 // you may watch video notes to get the idea } string* deleteEntry(string* dynamicArray, int& size, string entryToDelete) { // you implement this. Please read Programming Project 6 on page 536 // you may watch video notes to get the idea } void print(const string* dynamicArray, int size) { // you implement this. // you may watch video notes to get the idea }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started