Can someone look through this and tell me why amount isn't displaying anything in the "Total" file? I can't figure it out. Trying to refresh myself on C++ right now, so my brain isn't functioning correctly. Also why it's not displaying anything when I add in a cout statement.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string amount = "";
string minus = "";
double amount1 = 0.00;
double amount2 = 0.00;
double amount3 = 0.00;
double amount4 = 0.00;
double amount5 = 0.00;
double amount6 = 0.00;
string temp = "";
int comma = 0;
int electronicsRow = 0;
int clothesRow = 0;
int carRow = 0;
int foodRow = 0;
int paymentRow = 0;
int booksRow = 0;
string electronics[15][4] = {"0.0"};
string clothes[15][4] = {"0.0"};
string car[15][4] = {"0.0"};
string food[15][4] = {"0.0"};
string payment[15][4] = {"0.0"};
string books[15][4] = {"0.0"};
string supplies = "";
string type = "";
¿does your program terminate?
if yes, you never enter that loop and so `supplies' remains an empty string (¿why the hell is it a string?)
if no, then you never write to the file.
comment your code and show your input file structure.
I should clarify, it does show something, but only "Total money spent". And not the amount underneath like I want it to. It's a string because I never learned a better way of reading data from a text file and using that. What I originally posted is my entire code aside from the Accounting2.txt file, one line of which is Electronics,-22.26,2017,11