Trying to read in input of integers and insert them into a file, but how do I get the loop to end once integers have all been inputted? For example, if I enter 34, 56, and 12, they should be inserted into the file and the loop should end. However, after it runs through the loop 3 times to insert those numbers, it goes back to the top and prompts me to enter more numbers when it should exit the loop and continue with the rest of the program.
while(cin >> f && f != '\n') {
num = f * b % N;
CharFile << num << endl;
}