#include <iostream>
using namespace std;
struct node
{
};
void create();
int main() {
int n,i,d,a[100],f=0;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
cin>>d;
for(i=0;i<n;i++)
{
if(a[i]==d)
f=1;
}
if(f==0)
cout<<"Invalid position!\n";
cout<<"Linked List : ";
for(i=0;i<n;i++)
{
if(a[i]==d)
continue;
else
cout<<"->"<<a[i];
}
return 0;
}
using namespace std;
struct node
{
};
void create();
int main() {
int n,i,d,a[100],f=0;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
cin>>d;
for(i=0;i<n;i++)
{
if(a[i]==d)
f=1;
}
if(f==0)
cout<<"Invalid position!\n";
cout<<"Linked List : ";
for(i=0;i<n;i++)
{
if(a[i]==d)
continue;
else
cout<<"->"<<a[i];
}
return 0;
}
No comments:
Post a Comment