Take a look at the "points" section.
It says that i haven't declared the string name for "scores"... but scores is an int name not a string.
Whats going on?
#include <iostream>
#include <string>
using namespace std;
int main()
{
const int MAX=4;
std::string names1[4] = {"Anna" , "Jenny", "George" , "Michael"};
int score[4];
string names2[4] = {"John Lennon", "Yoko Ono", "Jimi Hendrix", "Peter Frampton"};
int score2[4];
double points[4];
cout << endl;
cout << "ENTER SCORES FOR DIVISION 1" << endl << endl;
for(int i = 0; i < 4; i++)
{
cout << names1[i] << ": ";
cin >> score[i];
cin.ignore();
}
cout << "ENTER SCORES FOR DIVISION 2" << endl << endl;
for(int i = 0; i < 4; i++)
{
cout << names2[i] << ": ";
cin >> score2[i];
cin.ignore();
}
system("cls");
//sort by score (div 1)
for ( int i = 0; i < 4; i++ )
{ score[i];
for ( int j = 0; j < 4; j++ )
{
if( score[i] > score[j] )
{
string tmp_string;
int temp;
temp = score[i];
tmp_string = names1[i];
score[i] = score[j];
names1[i] = names1[j];
score[j] = temp;
names1[j] = tmp_string;
}
}
}
//sort by score (div2)
for ( int i = 0; i < 4; i++ )
{ score2[i];
for ( int j = 0; j < 4; j++ )
{
if( score2[i] > score2[j] )
{
string tmp_string;
int temp;
temp = score2[i];
tmp_string = names2[i];
score2[i] = score2[j];
names2[i] = names2[j];
score2[j] = temp;
names2[j] = tmp_string;
}
}
}
//Points
for ( int i = 0; i < 4; i++ )
{
if ( names1[i].score[i] == 0 )
names1[i].points = 0;
else
names1[i].points = i + 1;
}
for ( int i = 0; i < 4; i++ )
{
if ( names2[i].score2[i] == 0 )
names2[i].points = 0;
else
names2[i].points = i + 1;
}
//output
cout << "DIVISION 1" << endl;
for ( int k = 0; k < 4; k++ )
{
cout << endl;
cout << names1[k] << ": "<< score[k] << " ";
}
cout << endl << endl;
cout << "DIVISION 2" << endl;
for ( int k = 0; k < 4; k++ )
{
cout << endl;
cout << names2[k] << ": "<< score2[k] << " ";
}
system("pause");
}