Untitled
unknown
c_cpp
2 years ago
579 B
6
Indexable
#include <iostream>
#include <map>
int main()
{
int values[100];
int was[100];
int lenWas = 0;
int n;
bool isNt = false;
std::cin >> n;
for (int i = 0; i < n; i++) {
std::cin >> values[i];
}
for (int i = 0; i < n -1; i++) {
isNt = false;
for (int j = i + 1; j < n; j++) {
if (values[i] == values[j]) {
for (int g = 0; g < lenWas; g++) {
if (values[j] == was[g]) {
isNt = true;
}
}if (isNt == false) {
std::cout << values[i] << " ";
was[lenWas] = values[i];
lenWas += 1;
}
}
}
}
}Editor is loading...
Leave a Comment