modify "DynamicStringArray.cpp" file to make the program output the correct output. PLEASE i only have to modify the " DynamicStringArray.cpp" code to make the program right. Please help me. BELOW ARE THE PROVIDED CODES IN ORDER TO COMPLETE IT: DynamicStringArray.cpp: // Write the implementation of every method of the class // DynamicStringArray defined in DynamicStringArray.h #include "DynamicStringArray .h" //default constructor DynamicStringArray ::DynamicStringArray (){ //write code body of DynamicStringArray () } int DynamicStringArray ::sizeIs(){ //write code body of sizeIs () } void DynamicStringArray ::addEntry (string str){ //write code body of addEntry () }; bool DynamicStringArray::deleteEntry (string str){ //write code body of deleteEntry () } string* DynamicStringArray::getEntry(int index){ //write code body of deleteEntry () } //destructor DynamicStringArray ::~DynamicStringArray (){ //write code body of ~DynamicStringArray () } void DynamicStringArray ::printDynamicArray(){ //write code body of printDynamicArray () }
C++ programming language
Images attached are the task and targeted output.
I was asked to modify "DynamicStringArray.cpp" file to make the program output the correct output.
PLEASE i only have to modify the " DynamicStringArray.cpp" code to make the program right. Please help me.
BELOW ARE THE PROVIDED CODES IN ORDER TO COMPLETE IT:
DynamicStringArray.cpp:
// Write the implementation of every method of the class
// DynamicStringArray defined in DynamicStringArray.h
#include "DynamicStringArray .h"
//default constructor
DynamicStringArray ::DynamicStringArray (){
//write code body of DynamicStringArray ()
}
int DynamicStringArray ::sizeIs(){
//write code body of sizeIs ()
}
void DynamicStringArray ::addEntry (string str){
//write code body of addEntry ()
};
bool DynamicStringArray::deleteEntry (string str){
//write code body of deleteEntry ()
}
string* DynamicStringArray::getEntry(int index){
//write code body of deleteEntry ()
}
//destructor
DynamicStringArray ::~DynamicStringArray (){
//write code body of ~DynamicStringArray ()
}
void DynamicStringArray ::printDynamicArray(){
//write code body of printDynamicArray ()
}
DynamicStringArray.h:
// Please do not change the this file !!!!!
//***********************************************//
#ifndef DYNAMICSTRINGARRAY _H
#define DYNAMICSTRINGARRAY _H
#include <iostream>
#include <string>
using namespace std;
class DynamicStringArray
{
public:
DynamicStringArray();
int sizeIs();
string* getDynamicArray ();
void addEntry (string);
bool deleteEntry (string);
string* getEntry(int );
~DynamicStringArray ();
void printDynamicArray();
private:
string *dynamicArray;
int size;
};
#endif // DYNAMICSTRINGARRAY _H
Main.cpp:
// Do not change the this main program !!!!!
//***********************************************//
#include "DynamicStringArray .h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
int op;
string str;
DynamicStringArray List; //DynamicStringArray=NULL size=0
cout<<"------>>> choose an option from the menu <<<------"<<endl;
cout<<" 1.Add an entry to the list of string........"<<endl;
cout<<" 2.Delete an entry to the list of string....."<<endl;
cout<<" 3.Display the list entries.................."<<endl;
cout<<" 4.End Program..............................."<<endl;
do{
cout<<"\n >> Enter your option from the menu:";
cin>>op;
if(op<=0 || op>5) {
cout<<"Wrong choice. Try again!!"<<endl;
continue;
}
switch(op){
case 1:
cout<<" >>> Enter a string to add to the list: ";
cin>> str;
List.addEntry (str);
break;
case 2:
cout<<" >>> Enter a string to remove from the list: ";
cin>> str;
List.deleteEntry(str);
break;
case 3:
List.printDynamicArray();
break;
case 4:
break;
}
} while(op!=4);
cout<<"End of Program.Bye!";
return 0;
}



Trending now
This is a popular solution!
Step by step
Solved in 2 steps









