Computer Science, asked by atharvackulkarni, 19 days ago

Write a program that creates a vector of user given size M using NEW operator( by creating a class)

Answers

Answered by prabhudeepak76
2

Answer:

#define null 0

#include <iostream.h>

#include <conio.h>

void main()

{

void memory(int);

clrscr();

textcolor(16);

textbackground(1235);

clrscr();

cout<<"Enter Memory M you Want to create:-";

int size;

cin>>size;

memory(size);

getch();

}

//MEMORY function

void memory(int s)

{

int *m = new int[s];

if(m!=null)

{

cout<<"\nWe are Successfull";

cout<<"\n\n\n\n\tNow You Want to Delete This Created Memory";

cout<<"\n\n\tEnter Y or y for Deleting else anything:-";

char ch;

cin>>ch;

if(ch=='y' || ch=='Y')

{

delete[]m;

cout<<"\n\n\n\tCreated Memory is Delete";

}

else

cout<<"\n\n\tOK, your Memory is Safe";

}

else

cout<<"\nWe are UN-Successfull";

}

Similar questions