So I have a input file which contains several different integer values(each in a seperate line), now I need to read each value, find the square root and get the output. The issue I am having is that my code only reads the first value from the input file. I have a feeling I am supposed to be using a loop to read each value seperately, so if someone can help me out it would be really appreciated.
float file_inp() //reads values from file and calculates the square root
{
    float y = 0;
    ifstream fin;
    fin.open("input.txt",ios::in);
    if (fin)
    {
        int x = 0;
        fin >> x;
        y=sqrt(x);
    }
    return y;
}
int main()
{
    float y = 0;
    cout << file_inp();
    system("Pause");
    return 0;
}
 
     
    