How do I load a vector, let the user enter all values, which can not have repeated numbers?
For example, a vector of 20 positions that asks the user to enter each value, and, when reporting a value equal to any previous one, a message would appear and it would be necessary to enter another value.
My code so far:
main()
{
printf("Insira os dados do vetor A\n");
for(i = 0; 20 > i; i++)
{
scanf("%d",va[i]);
auxva = va[i];
for(j = 0; 20 > j; j++)
{
if (va[j] == auxva)
{
printf("Sem valores repetidos\n");
scanf("%d",&auxva);
}
if(va[j] != auxva)
continue;
}
}
}