when I run the program does not show the output can anybody fix my error.



#include <iostream>
#include <string>
using namespace std;

/* ******************** getSize ********************
asks user for size
size saved in calling function via reference parameter
*/
void getSize(int);

/* ******************** getSpace ********************
gets an array whose size is chosen by the user
size saved in calling function via reference parameter
*/
void getSpace(int);

/* ******************** inputData ********************
gets data collected by the user's inputs
size saved in calling function via reference parameter
*/
void inputData(int[], int);

/* ******************** printData ********************
prints the strings, one per line
size saved in calling function via reference parameter
*/
void printData(int[], int);

/* ******************** destroy ********************
returns all space to the heap
size saved in calling function via reference parameter
*/
void destroy(int* ptr);

int main ()
{
int size;
int strings[size];

getSize(size);
getSpace(size);
inputData(strings, size);
printData(strings, size);
destroy(strings);

return 0;
}

void getSize(int size)
{
cout << "Please input the size of your array: ";
cin >> size;
}

void getSpace(int size)
{
int *strings;
strings = new int[size];
}

void inputData(int *strings, int size)
{
cout << "Please input your strings:" << endl;
for (int i = 0; i < size; i++)

{
cin >> strings[i];
}
}

void printData(int* strings, int size)
{
for (int i = 0; i < size; i++)
{
cout << strings[i] << endl;
}
}

void destroy(int* ptr)
{
delete ptr;
}
Last edited on
We're not going to do your homework for you.
Make an attempt and we will help with any questions or problems you have.
Topic archived. No new replies allowed.