Как исправить прекращение, вызванное после броска экземпляра std :: out_of_rangeC++

Программы на C++. Форум разработчиков
Anonymous
Как исправить прекращение, вызванное после броска экземпляра std :: out_of_range

Сообщение Anonymous »

Вот сообщение: < /p>

terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::erase: __pos (which is 18446744073709551615) > this->size() (which is 22)
Aborted (core dumped)
< /code>

и ниже мой код до сих пор (он должен переформатировать имена, даты и суммы в файле акрасблированных данных, чтобы он выглядел как: < /p>

Foster, Jerry Lee 1995 329,475
< /code>



//This program reformats the retirement account data file oldretirement.txt and outputs the data into a new file newretirement.txt

#include
#include
#include
#include
#include
#include
#include

using namespace std;

void getridof(string &line);
int splitamount(string &line);
int splityear(string &line);
string splitfullname(string &line);

int main(){

ifstream fin;
ofstream fout;
string line;
string finalname;
size_t found;
int finalamount;
int finalyear;

fin.open("oldretirement.txt");
if(fin.fail())
{cout

Подробнее здесь: https://stackoverflow.com/questions/405 ... t-of-range

Вернуться в «C++»