yes bro
#include<iostream>
using namespace std;
int get(int arr[],int index,int n)
{ if(index<=n)
{return arr[index];
}
}
int set(int arr[],int a,int k)
{
{ return (arr[a]=k);
}
}
int maximum(int arr[],int n)
{ int max=0;
for(int i=0;i<=n;i++)
{ if(arr[i]>max)
{max=arr[i];
}
} return max;
}
int minimum(int arr[],int n)
{ int min=arr[0];
for(int i=0;i<n;i++)
{if(arr[i]<min)
{ min=arr[i];
}
} return min;
}
int main()
{
cout<<"enter the size of array who want to create"<<endl;
int n;
cin>>n;
int arr[n];
for(int i=0;i<=n;i++)
{
cin>>arr[i];
}
int index;
cout<<"enter the index you want to see"<<endl;
cin>>index;
cout<<get( arr, index, n);
int a;
cout<<endl<<"enter the index you want to replace"<<endl;
cin>>a;
int k;
cout<<"enter the key element"<<endl;
cin>>k;
int v = get(arr, k, n);
set(arr,a,v);
cout<<endl<<"congratulations you have replaced your element"<<endl;
cout<<"do you want to see the current array (y/n)"<<endl;
char option;
cin>>option;
if(option='y')
{ for(int i=0;i<=n;i++)
{cout<<arr[i]<<endl;
}
}
else
{ cout<<"thank you"<<endl;
}
maximum(arr,n);
minimum(arr,n);
}
This works, you have to find the value and replace the value, you don't put index of it but the value you want to replace using set.