#include <iostream>
float x[10], k;
int n, i;
cout<<"N= "; cin>>n;
for (i=0; i<n; i++){
cout<<"x["<<i<<"]= ";
cin>>x[i];
}
cout<<"Array's elements: ";
for (i=0; i<n; i++)
cout<<x[i]<<", ";
cout<<endl<<"K= "; cin>>k;
for(i=0; i<n; i++)
if(x[i]!=k){
cout<<endl<<"K doesn't exist in array.";
cout<<endl<<"K= "; cin>>k;
}
I am trying to find if an element exists in array, if it doesn't exist I want to re-type the element and to repeat the whole array and check it. Mine doesn't get it from the start (i=0).