Ecco signore:
codice:
#include <iostream.h>
void main (void) {
int i, j, t, c;
int array[] = { 2, 3, 4, 2, 7, 9, 12, 7, 2, 23, 9, 31 };
i = 12;
/* ordino il vettore con un Sort mooolto noto :P */
do {
t = 0;
for (j = 0; j < i; j++)
if (array[j] >= array[j + 1]) {
t = 1;
c = array[j];
array[j] = array[j + 1];
array[j + 1] = c;
}
i--;
} while (t);
/* fine ordinamento */
for (i = 0; i < 12; i++)
if (array[i] == array[i + 1]) {
cout << array[i] << " ";
while (array[i] == array[i + 1]) /* per non ripetere */
i++;
}
cout << endl;
return (0);
}
PS: c'è anche il 7 di doppio.
Controlla! Ciao :gren: