I need Help with this Array Programming

You will code, build, and execute two programs requiring arrays and strings.

First program (Video Game Player Program): Determine the average score for a group of players and then determine who scored below average.

Second program (Pig Latin): Convert words in a phrase to pig latin.

Learning outcomes:

1. Be able to explain the need for arrays in a program.
2. Be able to determine the appropriate array data type to use in a given program.
3. Be able to write a program that implements arrays.
4. Be able to explain the way memory is allocated for arrays in a program.
5. Be able to explain the fact that arrays are objects in C++.
6. Be able to write a program that implements strings.

For each program, what have you written so far?

#include <iomanip>
#include <string>
using namespace std;
void headings ();

int main ()

{
string playerName;
string names[]={"Player Name"};
double score [6];
int average[6];// after finding the scores
double ext [6]; // if you can compute then don't store

//input new data
for (int i=0; i<6; ++i)
{

cout << " Enter player name (Q to quit)" << names[i]<<":" ; cin >> playerName[i];
cout << "Enter score for :"; cin >> score[i];

}

headings ();
//show report data
for (int i=0; i<6; ++i)
{

//detail line

cout << setw(8) << names[i] << setw(6);
cout << score[i] << setw(6) << average[i] << setw(6) << score[i] * average[i] << endl;

}


}


void headings()
{

cout << setw(8) << "Name" << setw(6);
cout << "Score" << setw(6) << "Averages" << setw(6) << "Ext" << endl;
cout << setw(8) << "----" << setw(6);
cout << "----" << setw(6) << "---" << setw(6) << "---" << endl;
}
Topic archived. No new replies allowed.