should use the code tags... I'm tired but I'll look at this tomorrow morning
Code:#include <iostream> #include <iomanip> #include <string> using std::cin; using std::cout; using std::endl; using std::left; using std::setiosflags; using std::setw; using std::ios; using namespace std; //function prototypes void displayHead(); void displayTopOfForm(string []); void displayDataArray(string [][2], int [][2]); int main() { //declare variables int player[10][2] = {0}; int battAvg[10] = {0}; string playerName[10][2] = {{"Adam", "1"}, {"Ben", "2"}, {"Carl", "3"}, {"Don", "4"}, {"Eric", "5"}, {"Frank", "6"}, {"Glenn", "7"}, {"Han", "8"}, {"Ian", "9"}, {"Jon", "10"}}; string header[5] = {"Player", "Number", "AtBats", "Hits", "BattAVG"}; //calculate batting average //call display functions displayHead(); cout << endl; displayTopOfForm(header); cout << endl << endl; displayDataArray(playerName, player); return 0; } //end of main function //*********************called functions************************** //begin displayHead function void displayHead() { cout << setw(52) << "Batting Average Program" << endl; } //end displayHead function //begin displayTopOfHeader function void displayTopOfForm(string topForm[]) { for (int i=0; i<5; i++) { cout << setiosflags(ios::right) << setw(14) << topForm[i]; } } //end displayTopOfForm function //displayArray function void displayDataArray(string name[][2], int stats[][2]) { for (int i=0; i<10; i++) { for (int j=0; j<2; j++) { cout << setiosflags(ios::left) << setw(14) << name[i][j]<< setw(14); cout << stats[i][j] << setw(14); } cout << endl; } //end for } //end displayArray function __________________




Reply With Quote