-1
good evening, I am developing a question, it is almost complete, being able to delete repeated values sequentially, for example: 1 1 2 3 4 5 1, as it excludes 1 and 1 and leaves only 2 3 4 5 1, however, if I type 1 2 3 4 1, it prints this sequence, without removing the repeated ones, what should I change in my code to resolve this? If anyone can help, I’d appreciate it. is annexed hereto:
#include <stdio.h>
#include <string.h>
int main() {
    int vet[10];
    int pos[10];
    int semdup[10];
    int qtd=0; int qtd1=0;
    for (int i = 0; i < 10; ++i) {
        scanf("%d", &vet[i]);
        if (vet[i]>0) {
            pos[qtd++] = vet[i];
        } else {
            printf("Negativo.\n");
        }
    }
    printf("\n");
    for (int i = 0; i < 10; ++i) {
        printf("%d ", vet[i]);
    }
    printf("\n");
    for (int i = 0; i < qtd; ++i) {     
        printf("%d ", pos[i]);
    }
    printf("\n");
    for (int i = 0; i < qtd; ++i) {     
            if (pos[i] == pos[i+1]) {
                pos[i] = pos[i+1];
                        
            } else {
                semdup[qtd1++] = pos[i];
            }
    }
    for (int i = 0; i < qtd1; ++i) {
        printf("%d\n", semdup[i]);
    }
    return 0;
}
						
I thank you so much for your help, I had not thought of ordering, I’m still a little bad in this area, it worked ordering, thanks.
– natalia