#include <iostream>
using namespace std;
union point {
int decimal;
double _float;
void init() {
cin >> _float;
if ((int) _float == _float) {
decimal = (int) _float;
}
}
double get() {
if (_float != NULL) return _float;
return decimal;
}
};
struct points {
point value;
};
int main() {
size_t n;
printf("Enter the size of size of array:");
cin >> n;
struct points _points[n];
double query;
for (int i = 0; i < n; ++i) {
cout << "Enter value" << endl;
_points[i].value.init();
}
cout << "Entered array:" << endl;
for (int i = 0; i < n; ++i) {
cout << i << " - " << _points[i].value.get() << endl;
}
cout << "Enter what do you want search:" << endl;
cin >> query;
for (int i = 0; i < n; ++i) {
if ((int) query == query) {
if ((int)_points[i].value.get() == query) {
cout << "Point with value = " << query << " found." << endl;
cout << i << " - " << "value: " << _points[i].value.get() << endl << endl;
}
} else {
if (_points[i].value.get() == query) {
cout << "Point with value = " << query << " found." << endl;
cout << i << " - " << "value: " << _points[i].value.get() << endl << endl;
}
}
}
}