Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void inputFunction(ifstream& infile);
int main()
{
inputFunction(infile);
}
void inputFunction(ifstream& infile)
{
ifstream infile;
infile.open("expenses.txt");
string day1, day2, day3, day4, day5, day6, day7, day, food, clothing, school, entertainment;
double food1, food2, food3, food4, food5, food6, food7;
double clothing1, clothing2, clothing3, clothing4, clothing5, clothing6, clothing7;
double school1, school2, school3, school4, school5, school6, school7;
double ent1, ent2, ent3, ent4, ent5, ent6, ent7;
double totalFood, double totalClothing, double totalSchool, double totalEnt;
double averageFood, double averageClothing, double averageSchool, double averageEnt;
ifstream infile;
infile >> day >> " " >> food >> " " >> clothing >> " " >> school >> " " >> entertainment;
cout << " " << endl;
infile >> day1 >> " " >> food1 >> " " >> clothing1 >> " " >> school1 >> " " >> ent1;
cout << " " << endl;
infile >> day2 >> " " >> food2 >> " " >> clothing2 >> " " >> school2 >> " " >> ent2;
cout << " " << endl;
infile >> day3 >> " " >> food3 >> " " >> clothing3 >> " " >> school3 >> " " >> ent3;
cout << " " << endl;
infile >> day4 >> " " >> food4 >> " " >> clothing4 >> " " >> school4 >> " " >> ent4;
cout << " " << endl;
infile >> day5 >> " " >> food5 >> " " >> clothing5 >> " " >> school5 >> " " >> ent5;
cout << " " << endl;
infile >> day6 >> " " >> food6 >> " " >> clothing6 >> " " >> school6 >> " " >> ent6;
cout << " " << endl;
infile >> day7 >> " " >> food7 >> " " >> clothing7 >> " " >> school7 >> " " >> ent7;
cout << " " << endl;
}
I know it's ugly looking and I apologize for that. I'm getting errors. I don't know what I'm doing and I'm on the verge of switching my major. I'm so frustrated right now. Can someone please help me along the way? I'd appreciate it more than you know.