How to properly use cin.peek()
问题 This function is supposed to read a fraction and place it in an array. If the user enters '0' the function is supposed to exit. I am trying to do this using the cin.peek() function but execution always goes into the if statement and doesn't allow the user to exit. How should I properly code this (I am open to not using peek(), I thought it was the simplest way of doing it.) Thanks! void enterFrac(Fraction* fracs[], int& index) { int n, d; char c, slash; cout << "Enter fractions (end by