Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
579 B
0
Indexable
Never
#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;
				}
			}
		}
	}
}
Leave a Comment