void Client::autoSavingBook() { vector t; readClientSaving(t); for (int i = 0; i < t.size(); i++) { for (int j = 0; j < t[i].m_countSaving; j++) { ifstream fin("OOP6/Client/Saving Book/" + t[i].m_IDcard + "_" + to_string(j + 1) + ".txt"); string filetemp = "OOP6/Client/Saving Book/" + t[i].m_IDcard + "_" + to_string(j + 1) + ".txt"; if (!fin.is_open()) { cout << "No"; } Client temp, temp2; int month; // fin.ignore(); getline(fin, temp.m_name, '\n'); getline(fin, temp.m_IDcard, '\n'); fin >> temp.m_gender; fin.ignore(); fin >> month; fin.ignore(); fin >> temp.m_time.day; fin.ignore(); fin >> temp.m_time.month; fin.ignore(); fin >> temp.m_time.year; fin.ignore(); fin >> temp.m_moneySaving; fin.ignore(); fin >> temp2.m_time.day; fin.ignore(); fin >> temp2.m_time.month; fin.ignore(); fin >> temp2.m_time.year; fin.ignore(); fin >> temp2.m_moneySaving; fin.ignore(); fin >> temp.m_status; fin.close(); if (temp.m_status == 1) { time_t now = time(0); tm* ltm = localtime(&now); Date dtemp; dtemp.day = ltm->tm_mday; dtemp.month = ltm->tm_mon + 1; dtemp.year = ltm->tm_year + 1900; if (compareDay(dtemp, temp2.m_time) >= 0) { NextDays(temp2.m_time, month); ofstream fout(filetemp); fout << temp.m_name << endl; fout << temp.m_IDcard << endl; fout << temp.m_gender << endl; fout << month << endl; fout << (temp.m_time.day < 10 ? "0" : "") << temp.m_time.day << " " << (temp.m_time.month < 10 ? "0" : "") << temp.m_time.month << " " << temp.m_time.year << endl; fout << temp.m_moneySaving << endl; fout << (temp2.m_time.day < 10 ? "0" : "") << temp2.m_time.day << " " << (temp2.m_time.month < 10 ? "0" : "") << temp2.m_time.month << " " << temp2.m_time.year << endl; fout << calcMoneyReceived(temp2.m_moneySaving, month) << endl; fout << "1" << endl; //status of saving book fout.close(); } } } } }