- #include <iostream>
- #include <cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- int a[]{0,0,0,0,0,0,0,0,0,0};
- for(int i=0; i<=9; i++)
- {
- re:
- a[i]=rand()%38+1;
- for(int j=0; j<i; j++)
- {
- if(a[i]==a[j])
- {
- goto re;
- }
- }
- }
- for(int i=0; i<=9; i++)
- {
- cout<<a[i]<<" ";
- _sleep(500);
- }
- system("pause");
- return 0;
- }
複製代碼 |