I need to take a number from an ifstream inputFile, add or subtract (depending on what the user wants), do that operation with the number and then write it back into the file. It should end up looking like this in the file:
Titan Bookstore Online
It has to work with more than 2 transactions. I am able to write the initial deposit and gather the date, transaction name, and amount but not the new total. My code so far is:
Just as my initial thoughts based on your project description, what you want to do is store your initial deposit into a float in a manner such as B >> number;, do your math, then output it as the final amount like B << number;. Upon looking at your code it seems that you're underutilizing the fstream, or using fstream erroneously when you want to be using ifstream for inB and ofstream for outB.
UPTADE 1: I've been testing your code myself and the first big issue I encountered was that your stringstream ss never got initialized. The first thing you should do with objects in C/C++ is either call a constructor on them or assign them something. ss << accountNumber << ".dat"; may include an assignment, but the compiler doesn't know that. Scratch what I said about stringstream. I'm learning too.