Why is my score corrupted???
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
string names[10];
int score[10];
for(int scores = 10; scores >= 0; scores--)
{
cout << "What is your score? ";
cin >> score[scores];
cout << endl;
}
int swapHolder = -1;
int ten = 10;
for(int counter = 9; counter >= 0; counter--)
{
for(int i = 0; i < 10; i++)
{
if(score[i] > score[i + 1])
{
swapHolder = score[i + 1];
score[i + 1] = score[i];
score[i] = swapHolder;
}
}
ten--;
}
for(int i = 10; i >= 0; i--)
{
cout << "Score: " << score[i] << endl;
}
system("pause");
return 0;
}