Skip to content

Create deleteelement.cpp #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Create deleteelement.cpp
  • Loading branch information
glgibran7 authored Oct 19, 2020
commit f1a81fd5429d3148b39733c57342632a99b4a8a6
23 changes: 23 additions & 0 deletions deleteelement.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

#include<iostream>
using namespace std;

int main()
{
int i,j,k,n,a[30];
cout<<"How many elements? "; cin>>n;
cout<<"Enter elements of array\n";
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
for(j=i+1;j<n;)
if(a[i]==a[j]){
for(k=j;k<n-1;++k)
a[k]=a[k+1];
--n;
}
else{ ++j;}
for(i=0;i<n;++i)
cout<<a[i]<<" ";
return 0;
}