C++ programming language. Please help me complete the DynamicStringArray.cpp. I pasted the codes that you need to complete it. Below is DynamicStringArray.h,DynamicStringArray.cpp, and the main.cpp. Please help me.
C++
Please help me complete the DynamicStringArray.cpp.
I pasted the codes that you need to complete it. Below is DynamicStringArray.h,DynamicStringArray.cpp, and the main.cpp. Please help me.
below code is 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
BELOW IS 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;
}
Below is the code i have to change:
// 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 ()
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps