I have a function that's only purpose is to edit a file and it is not reading the correct input from the file
PAYMENT = "payment.txt"
payment.txt contains: 1 12000 200
2 26766 382.371
void Customer::makePayment()
{
int i = 0;
float monthly, payOff, payment;
string userName;
ifstream fin(PAYMENT);
if (!fin.is_open())
cout << "FILE NOT FOUND\n";
ofstream fout(PAYMENT, ios::trunc);
if (!fout.is_open())
cout << "FILE NOT FOUND\n";
while(!fin.eof())
{
fin >> userName;
fin >> payOff;
fin >> monthly;
if (userName == this->userName)
{
cout << "payment amount: $";
cin >> payment;
payOff = payOff - payment;
}
fout << userName << " " << payOff << " " << monthly;
}
fin.close();
fout.close();
}
the fin is only taking in the number -107374176