Expand|Select|Wrap|Line Numbers
- #include <iostream>
- using namespace std;
- int main() {
- int scores[20]; //array of numbers
- int value;
- int dupe;
- int count;
- //prompt user for the list of numbers with zero being the end of the input.
- cout << "enter a list of numbers: ";
- for (int i=0; i < 20; i++){
- cin >> value;
- if (value == 0)
- {
- break;
- }
- scores[i] = value;
- if (scores[i] == value)
- {
- dupe = 1;
- }
- }
- if (dupe != 1)
- {
- scores[count] = value;
- }
- count++;
- cout << value;
- }