I'm not understanding something about my program
EDIT: I didn't read the "READ BEFORE POSTING" topic b/c I'm dumb. I just tried to edit it to put code tags but I couldn't figure out how. Sorry..... :-(
I'm having a problem with my program and I don't know what the problem is. I searched the internet after all my friends in my class were unavailable and hope this can help.
In my program, I'm computing what the max and min values of the input table are. The table has 4 columns consisting of Time, Temp, Pressure, and Volume. The max and mins are the values for each T,P, and V at whatever time it is at. Becuase I can't post brackets for my if statements in a post here, I'm replacing them with \ and / respectively.
The problem with this program is that the variables for my min and max values are not working out. When I go to put them in the last cout statements (I just wrote timemint as the last line to test it) it says error C2065: 'timemint' : undeclared identifier and I don't know why.
ifstream in("homework4data.txt");
ofstream outFile("HW5.txt");
outFile << "TIME " << setw(23) << " TEMPERATURE " << setw(13) << " PRESSURE " << setw(13) << " VOLUME" << endl;
cout << "TIME " << setw(23) << " TEMPERATURE " << setw(13) << " PRESSURE " << setw(13) << " VOLUME" << endl;
outFile << "================================================= =====" << endl;
cout << "================================================= =====" << endl;
int mTime;
double t,p,v,SumT = 0, SumP = 0,SumV = 0;
double CountT = 0, CountP = 0, CountV = 0;
outFile << setiosflags(ios::fixed) << setprecision(2);
cout << setiosflags(ios::fixed) << setprecision(2);
while ( ! in.eof() ) \
in >> mTime >> t >> p >> v;
if (!in.fail()) \
int h,m;
bool pm;
pm = mil2civTime(mTime,h,m);
if (pm)
cout << setw(2) << setfill(' ') << h << ':' << setw(2) << setfill('0') << m << " P.M." << '\t' << t << '\t' << '\t' << p << '\t' << '\t' << v << endl;
else
cout << setw(2) << setfill(' ') << h << ':' << setw(2) << setfill('0') << m << " A.M." << '\t' << t << '\t' << '\t' << p << '\t' << '\t' << v << endl;
if (pm)
outFile << setw(2) << setfill(' ') << h << ':' << setw(2) << setfill('0') << m << " P.M." << '\t' << t << '\t' << '\t' << p << '\t' << '\t' << v << endl;
else
outFile << setw(2) << setfill(' ') << h << ':' << setw(2) << setfill('0') << m << " A.M." << '\t' << t << '\t' << '\t' << p << '\t' << '\t' << v << endl;
double count = 0;
double mint,minv,minp,maxt,maxv,maxp;
int timemint,timeminv,timeminp,timemaxt,timemaxv,timem axp;
if (count == 1 || t < mint) \
mint = t;
timemint = mTime;
/
if (count == 1 || p < minp) \
minp = p;
timeminp = mTime;
/
if (count == 1 || v < minv) \
minv = v;
timeminv = mTime;
/
if (count == 1 || t > maxv) \
maxt = t;
timemaxt = mTime;
/
if (count == 1 || p > maxp) \
maxp = p;
timemaxp = mTime;
/
if (count == 1 || v > maxv) \
maxv = v;
timemaxv = mTime;
/
SumT += t;
CountT += 1;
SumP += p;
CountP += 1;
SumV += v;
CountV += 1;
/
/
outFile << "================================================= =====" << endl;
cout << "================================================= =====" << endl;
outFile << "AVERAGE" << '\t' << '\t' << SumT/CountT << '\t' << '\t' << SumP/CountP << '\t' << '\t' << SumV/CountV << endl;
cout << "AVERAGE" << '\t' << '\t' << SumT/CountT << '\t' << '\t' << SumP/CountP << '\t' << '\t' << SumV/CountV << endl;
cout << "================================================= =====" << endl;
cout << "STANDARD" << endl;
cout << '\t' << '\t' << "17.31" << '\t' << '\t' << ".3627" << '\t' << '\t' << "67.234" << endl;
cout << "DEVIATION" << endl;
cout << "================================================= =====" << endl;
cout << '\t' << '\t' << "MAXIMUM" << '\t' << '\t' << '\t' << '\t' << "MINIMUM" << endl;
cout << "Temperature" << '\t' << "???.?? @ ??:?? ?? ??.?? @ ??:?? ??" << endl;
cout << "Pressure" << '\t' << "???.?? @ ??:?? ?? ??.?? @ ??:?? ??" << endl;
cout << "Volume" << '\t' << '\t' << "???.?? @ ??:?? ?? ??.?? @ ??:?? ??" << endl;
cout << timemint << endl;