Wednesday, January 6, 2021

Delete Element from array in c++ with Eaglesoft programmers

 


#include <iostream>
using namespace std;
int main()
{
    int array[5] = {43256};
    int p;
    cout << "Before delete element" << endl;
    for (int i = 0i < 5i++)
    {
        cout << "Value of array[" << i << "] " << array[i<< endl;
    }
    cout << "Enter position of element that you want to delete:" << endl;
    cin >> p;
    for (int i = pi < 5i++)
    {
        array[i] = array[i + 1];
    }
    cout << "After delete element" << endl;
    for (int i = 0i < 4i++)
    {
        cout << "Value of array[" << i << "] " << array[i<< endl;
    }
    return 0;
}

No comments:

Post a Comment