* * The copyright and version of the Declaration section:
*copyright (c) 2013, Yantai University computer College students
*all rights reserved.
* File name:
* Author: Shang
* Date of Completion: May 25, 2014
* version number: v0.1
* Description of task and solution:
* Input Description: No
* Problem Description: Input 10 digits from keyboard, Remove duplicates, then from small to large output.
* Program Input:
* Program output:
* Problem Analysis:
* Algorithm Design: * *
#include <iostream>
using namespace std;
int main ()
{
int a[10],k=0,i,j;
for (int i=0; i<10; ++i)
{
cin>>a[i];
}
For (i=0, i<10; ++i) for
(j=0; j<9-i; ++j)
{
if (a[j]>a[j+1))
{
k=a[j];
A[J]=A[J+1];
A[j+1]=k
}
}
For (i=0 i<10; ++i)
{
if (a[i]==a[i+1))
{
++i;
}
cout<<a[i]<< "";
}
return 0;
}
Results show:
Experience: When the test, the program output error, did not remove duplicate numbers.