| 177 | } |
| 178 | |
| 179 | void outData(accounts oldData[]) { |
| 180 | ifstream file; |
| 181 | file.open("data.txt"); |
| 182 | if (!file.is_open()) { |
| 183 | cout << "Error\n"; |
| 184 | |
| 185 | } |
| 186 | else { |
| 187 | //cout << "file is opened\n"; |
| 188 | string str = ""; |
| 189 | int i = 0, j = 0; |
| 190 | string strArr[4]; |
| 191 | do { |
| 192 | getline(file, str, '|'); |
| 193 | if (j < 4) { |
| 194 | strArr[j] = str; |
| 195 | j++; |
| 196 | } |
| 197 | else { |
| 198 | oldData[i].name = strArr[0]; |
| 199 | oldData[i].password = strArr[1]; |
| 200 | oldData[i].balance = stoi(strArr[2]); |
| 201 | oldData[i].borrowed = stoi(strArr[3]); |
| 202 | ::increaments++; |
| 203 | j = 0; |
| 204 | strArr[j] = str; |
| 205 | j++; |
| 206 | i++; |
| 207 | } |
| 208 | |
| 209 | |
| 210 | |
| 211 | //cout<<str<<"|"; |
| 212 | }while (!file.eof()); |
| 213 | } |
| 214 | } |
| 215 | void inputNewData(accounts data) { |
| 216 | ofstream file; |
| 217 | file.open("data.txt", ofstream::app); |