Advertisement
Guest User

new

a guest
Mar 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8.     int i, inputarray[10], no, pos;
  9.  
  10.     cout << "Enter 10 data elements in array: ";
  11.     for (i = 0; i < 10; i++)
  12.     {
  13.         cin >> inputarray[i];
  14.     }
  15.     cout << "\nEnter position of element to delete: ";
  16.     cin >> pos;
  17.  
  18.     if (pos > 10)
  19.     {
  20.         cout << "\n position value is not in range: ";
  21.     }
  22.     else
  23.     {
  24.         --pos;
  25.         for (i = pos; i <= 9; i++)
  26.         {
  27.             inputarray[i] = inputarray[i + 1];
  28.         }
  29.  
  30.         cout << "\n\nNew data in array: ";
  31.  
  32.         for (i = 0; i < 9; i++)
  33.         {
  34.             cout << inputarray[i];
  35.             cout << " ";
  36.         }
  37.     }
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement