Answers for "delete index from array c++"

C++
0

delete index from array c++

const int SIZE = 9;
	int arr[SIZE];
	cout << "Enter numbers: \n";
	for (int i = 0; i < SIZE; i++)
		cin >> arr[i];
	for (int i = 0; i < SIZE; i++)
		cout << arr[i] << "\t";
	cout << endl;
	
	cout << "Enter Index U want to delete:\n";
	int del;
	cin >> del;
	for (int i = del-1; i < SIZE; i++)
	{
		arr[del] = arr[del + 1];
		del++;
	}
	for (int i = 0; i < SIZE - 1; i++)
		cout << arr[i] << "\t";
	cout << endl;
Posted by: Guest on January-12-2021

Browse Popular Code Answers by Language