#include <iostream>
#include <new>
#include <conio.h>
using namespace std;
int main ()
{
int i,n;
int * p;
cout << "How many numbers would you like to type? ";
cin >> i;
p= new (nothrow) int[i];
if (i == 0)
cout << "Error: memory could not be allocated";
else
{
for (n=0; n
{
cout << "Enter number: ";
cin >> p[n];
}
cout << "You have entered: ";
for (n=0; n
cout << p[n] << ", ";
delete[] p;
}
getch();
return 0;
}

Tidak ada komentar:
Posting Komentar