input from file

hi, how would i go about inputting a file and then checking if a number entered by the user in the console is present in that file?
That depends entirely on the contents of the file and how you read it.
the file contains many numbers set out like
1 3 5 6 7 9
1 4 6
is there a way to see if the file contains the number entered by the user? without knowing the contents of the file?
this method doesn't work because its only checking if the file IS that number not contains that number?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <fstream>
#include <conio.h>

using namespace std;

int main()
{
	int x;
	
	cout << "Enter any value: ";
	cin >> x;
	int counter=0;

	ifstream in("C:/problem2.txt");
	int filenum;
	in >> filenum;
	if(filenum == x) 
		counter=counter+1;
		cout << counter;

		getch();
		return 0;
}
Topic archived. No new replies allowed.