Professional Documents
Culture Documents
Task 3
Task 3
//120200632004
#include <iostream>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
}
Int main()
{ int I,j;
Srand (time(0));
Int ar[8],ar2[8]={0},counter=0;
For( i=0;i<8;i++)
Ar[i]=rand()%31+10;
For( j=0;j<I;j++)
If(ar[i]==ar[j])
Counter++;
If(counter != 0)
i--;
counter=0;
One(ar,ar2);
////////////////////////////////////////////////////////////////////
Int search,temp;
Int n=0,m=0,s;
For(i=0;i<100 ;i++ )
{ hhh:
Cin>>search;
For( j=0;j<8;j++)
{
If(search == ar[j])
If(j!=0)
M++;
Temp=ar[j-1];
Ar[j-1]=ar[j];
Ar[j]=temp;
Ar2[j]++;
Temp=ar2[j-1];
Ar2[j-1]=ar2[j];
Ar2[j]=temp;
S=j;
Goto hhh;
Break;
///////////////////////////////////////////////////////////////index 0
Else
M++;
Ar2[j]++;
S=j;
Goto hhh;
Break;
}
Else
N++;
/////////////////////////////////////////////////////////////
If(n == 8)
N=0;
Int temp2;
For( i=0;i<8;i++)
For( j=i+1;j<8;j++)
If(ar2[i]<=ar2[j])
Temp=ar2[i];
Ar2[i]=ar2[j];
Ar2[j]=temp;
Temp=ar[i];
Ar[i]=ar[j];
Ar[j]=temp;
}
}
Return 0;