I would like to take the sum of all the iterations of getline() and output it to the file I'm reading. However, this current idea of code I have makes the program crash.
int main()
{
// usual read file stuff
while (!in.eof())
{
string total;
double balance = stod(total);
getline(in, total);
cout << "$";
cout << right << setw(10) << total << '.' << cout.precision(2) << endl;
//guessing a for loop that would += balance
}