I need help in understanding how input file in C++ works. Here is what i need to do. I need to be able to open a input file called input.txt. That file will contain 15 numbers in a list format.
6
.34
74
34
12
31
23
.
.
.
First number will be the size of the hash the second would be a number to multiply by and then a list of numbers as keys, and finally the last number to be a number to search for using different hashing functions. Fist off i need help understanding how i can store the numbers seperatly so i can access for their use in other places in the program. I was thinking about placing all the numbers into an array. like below. Then accessing the number in the locations that corresponds to its place in the array. Let me know if you think that it might work this way or if there is a better way to do this.
ifstream in;
ofstream out;
int num;
in.open("input.txt");
in.open("output.txt");
int i = 0
in >> num;
while ( num )
{
a << num
in >> num;
}
return 0;
}
p = a[0];
Alpha = a[1];