I need help with my pa5.cpp program

Ok im suppose to use pa5.phone which consist of dates,calls,minutes,texts all are ints except date which is a string. This is what it looks like

02/25/2011 35 724 189
02/26/2011 126 4032 276
02/28/2011 45 990 85
03/01/2011 55 1705 102
03/02/2011 122 4026 124
03/04/2011 117 4446 209
03/05/2011 62 1674 98

And we have to total them up first to make it look like this

--------------------------------------…
Date Calls Minutes Texts
--------------------------------------…
02/25/2011 35 724 189
02/26/2011 126 4032 276
02/28/2011 45 990 85
03/01/2011 55 1705 102
03/02/2011 122 4026 124
03/04/2011 117 4446 209
03/05/2011 62 1674 98
--------------------------------------…
Totals 562 17597 1083

Then after that we have to use a while loop to find this

Statistics
--------------------------------------…
Average Minutes Per Day: 2513.9
Highest Number of Calls: 02/26/2011 126
Least Number of Texts: 02/28/2011 85

using a while loop to find the minutes per day what day had the most number of call and the day with the least texts. We have to use minDate=date; min=texts; max=calls; maxDate=date; we also have to use counters and sums..

i have this so far trying to get the first part which isn't coming out right.

#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;

int main()
{
ifstream inFile;
string date1,date2,date3,date4,date5,date6,date…
int calls1,minutes1,texts1,calls2,minutes2,t…
calls6,calls7,minutes3,minutes4,minutes5…
texts4,texts5,texts6,texts7,total;

inFile.open("pa5.phone");

inFile >> date1 >> calls1 >> minutes1 >> texts1;
inFile >> date2 >> calls2 >> minutes2 >> texts2;
inFile >> date3 >> calls3 >> minutes3 >> texts3;
inFile >> date4 >> calls4 >> minutes4 >> texts4;
inFile >> date5 >> calls5 >> minutes5 >> texts5;
inFile >> date6 >> calls6 >> minutes6 >> texts6;
inFile >> date7 >> calls7 >> minutes7 >> texts7;
inFile.close();
cout <<
"-------------------------------------…
cout << " Date Calls Minutes Texts\n";
cout <<
"-------------------------------------…
cout << setw(8) << date1 << setw(9) << calls1 << setw(10) << minutes1
<< setw(15) << texts1 << endl;

cout << setw(8) << date2 << setw(9) << calls2 << setw(10) << minutes2
<< setw(15) << texts2 << endl;

cout << setw(8) << date3 << setw(9) << calls3 << setw(10) << minutes3
<< setw(15) << texts3 << endl;

cout << setw(8) << date4 << setw(9) << calls4 << setw(10) << minutes4
<< setw(15) << texts4 << endl;

cout << setw(8) << date5 << setw(9) << calls5 << setw(10) << minutes5
<< setw(15) << texts5 << endl;

cout << setw(8) << date6 << setw(9) << calls6 << setw(10) << minutes6
<< setw(15) << texts6 << endl;

cout << setw(8) << date7 << setw(9) << calls7 << setw(10) << minutes7
<< setw(15) << texts7 << endl;
cout <<
"-------------------------------------…
cout << "Totals:" << endl;
cin >> total=calls1 + calls2 + calls3 + calls4 + calls5 + calls6 >> endl;
return 0;
}

Im trying to get the totals do i need a loop?
Topic archived. No new replies allowed.