#include "stdafx.h"
#include <iostream>
void PrintArray(int *pArray, int nSize)
{
usingnamespace std;
for (int iii = 0; iii < nSize; iii++)
{
cout << pArray[nSize] << " ";
}
}
int main()
{
usingnamespace std;
int nSize;
cout << "Please enter the size of your array: \n";
cin >> nSize;
int *anArray = 0;
anArray = newint [nSize];
for (int iii = 0; iii < nSize; iii++)
{
anArray[iii] = 0;
}
for (int jjj = 0; jjj < nSize; jjj++)
{
if (jjj == 0)
cout << "Please enter first array value: \n";
else
cout << "Please enter next array value: \n";
cin >> anArray[jjj];
}
PrintArray(anArray, nSize);
delete[] anArray;
anArray = NULL;
return 0;
}
I receive the following in the console window:
Please enter the size of your array:
2
Please enter first array value:
3
Please enter next array value:
4
-33686019 -33686019 Press any key to continue . . .