I need to create a function that uses a loop. This function will open a text file and then must be able to skip a variable number of leading random integers. The program must be able to handle any number of leading random integers.
Example if the opened file reads this on its first line:
100 120 92 82 38 49 102
and the SKIP_NUMBER
variable is assigned 3 the number the function would grab is 82.
The function must continue to grab the integers every SKIP_NUMBER
until it reaches the end of the file. These integers taken from the txt file are then placed into another text file.
Please help I'm really lost on how to create this loop! :D
Here is my function so far...
//Function skips variables and returns needed integer
int skipVariable (int SKIP_NUMBER)
{
return 0; //temporary return
}
These are my program variables:
// initialize function/variables
ifstream fin;
string IN_FILE_NAME, OUT_FILE_NAME;
int SKIP_NUMBER;