Question: C++ FORMAT PLEASE: THIS IS THE ASSIGNMENT: Write a program containing the following functions: main - calls the other functions; otherwise does nothing getSize -
C++ FORMAT PLEASE:
THIS IS THE ASSIGNMENT:
Write a program containing the following functions:
main - calls the other functions; otherwise does nothing
getSize - which asks the user how many strings they want
getSpace - which gets an array in the heap of the size requested by the user
inputData - which allows the user to input the strings and stores them
in the array
printData - which prints all the strings, one string per line
destroy - which returns all the space to the heap
All of these functions, except main, shall have a return type of void.
Put the main function first.
Use the function names specified above.
Arrange the functions in the order listed above.
THIS IS WHAT I HAVE SO FAR AND I DONT KNOW HOW TO FIX IT IF YOU CAN PLEASE HELP ME!
#include
#include
#include
using namespace std;
void getSize (int *size);
void getSpace (string *& pStrArr, int size);
void inputData (string &pStrArr, int size);
void printData (string *&pStrArr, int size);
void destroy (string *pStrArr);
int main ()
{
string *pStrArr;
int size;
getSize (&size);
getSpace (pStrArr, size);
inputData (*pStrArr, size);
printData (pStrArr, size);
destroy (pStrArr);
return 0;
}
void getSize (int *size)
{
cout << "Enter in how many strings you would like" << endl;
cin >> *size;
cin.ignore();
}
/************getSpace************
*/
void getSpace (string *& pStrArr, int size)
{
if (num <= )
}
/**********inputData*************
*/
void inputData (string &pStrArr, int size)
{
}
/***********printData*************
*/
void printData (string *&pStrArr, int size)
{
for (int i = 0; i < size; i++)
cout << "string number" << i + 1 << " : " << pStrArr[i] <<
}
/************Destroy**************
returns all the space to the heap.
function accepts a pointer to string array
*/
void destroy (string *pStrArr)
{
delete [] pStrArr;
pStrArr = 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
