hi
i try to make a dynamic array inside a loop but i have a problem
i want restore each time in the loop a name and print it out the delete the array the the loop go on the add other name the print it then delete it .....
but it didn't work with me , any idea?
here is my code:
i try to creat dynamic name inside a loop but/....!
int main()Code:i try to creat dynamic name inside a loop but/....!
{
char *names = NULL;
for (int i=0; i<3; i++)
{
if(names)
{
cout<<"yes"<<endl;
delete[]names;
names=NULL;
}
cout << "1- Enter the name : ";
names=new char [size];
cin.get (names , size);
char k;
do
{
cin.get(k);
}while(k!='\n');
cout<<names;
}
return 0;
}



LinkBack URL
About LinkBacks


