#include #include bool find(FILE* f); int main() { FILE* in = fopen("input.txt", "r"); if (in == NULL) { perror("Could not open input file"); return (-1); } bool found = find(in); fclose(in); FILE* out = fopen("output.txt", "w"); if (in == NULL) { perror("Could not open output file"); return (-1); } const char* res; if (found) res = "true"; else res = "false"; fprintf(out, "%s\n", res); fclose(out); return 0; } bool find(FILE* f) { int x; if (fscanf(f, "%d", &x) != 1) { perror("Incorrect input file"); exit(-1); } bool found = false; int a; while (!found && fscanf(f, "%d", &a) == 1) { if (a == x) found = true; } return found; }