- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- int sum;
- srand(time(NULL));
- for(int i=1;i<=20;i++){
- int n[4]={11,11,11,11};
- for(int o=1;o<=4;o++){
- s:
- sum=rand()%10;
- if(sum==n[0] || sum==n[1] || sum==n[2] || sum==n[3]){
- goto s;
- }else{
- n[o-1]=sum;
- }
- cout<<n[o-1]<<" ";
- }
- cout<<endl;
- _sleep(500);
-
- }
- system("pause");
- return 0;
- }
複製代碼 |