Napisałem kod i nie mam pojęcia jak napisać warunek na usunięcie elementu z tablicy, pomoże ktoś?
Oto mój kod:
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<ctime>
using namespace std;
void utworz(int*& t, const unsigned n){
t=new int [n];
for(unsigned i=0; i<n; i++)
t[i]=0;
}
void wypisz(const int* t, const unsigned n)
{
for(unsigned i=0; i<n; i++)
cout<<t[i]<<" ";
}
void usun(int* t, unsigned n)
{
if(t){
delete []t;
t=0;
n=0;}
}
void wypelnij(int*t, const unsigned n, const int min, const int max){
for(unsigned i=0; i< n; i++)
t [i]=min+ rand() % abs(max-min);
}
int*kasuj_element(const int* tab, const unsigned rozmiar, const unsigned ktory){
int *t=0;
utworz(t,rozmiar);
****TUTAJ NIE WIEM JAK TO ZROBIĆ
return t;
}
int main (){
srand(time(NULL));
int* t =0, min, max, ktory;
unsigned n;
do{
cout<<"podaj rozmian tab>0 oraz granice przedz oraz element ktory chcesz skasowac"<<endl;
cin>>n>>min>>max>>ktory;
}
while(n<1);
utworz(t,n);
wypelnij(t,n,min, max);
wypisz(t,n);
t= kasuj_element(t,n,ktory);
wypisz(t,n);
usun(t,n);
}