Hi there,
I know this question is very common but I still didn't understand that why we can't check if array is not initialized. Isn't there a way to check an array is initialzed by any values(int, double).
I am working on array based program, in which I have to populate array, print array, search item in array etc. I need to check that if array is not initalized by values user can't print, search values in array.
do
{
cout<<"Press 1 to populate array."<<endl;
cout<<"Press 2 to print array."<<endl;
cout<<"Press 3 to sort array."<<endl;
cout<<"Press 4 to search key in array."<<endl;
cout<<"Press 5 to delete number in array."<<endl;
menuNo = getch();
cout<<""<<endl;
switch(menuNo)
{
case '1':
{
popArr(arr, size);
}
break;
case '2':
{
printArr(arr, size);
}
break;
case '3':
{
sortArr(arr, size);
}
break;
case '4':
{
searchKey(arr, size);
}
break;
case '5':
{
deleteKey(arr, size);
}
break;
default:
{
cout<<"Invalid menu number !"<<endl;
}
break;
}
cout<<"Do you want to do another task(y/n) ??"<<endl;
repeat = getch();
cout<<""<<endl;
}while(repeat == 'y' || repeat == 'Y');
I need array based solution. I'll highly appreciate this.