SHOW:
|
|
- or go back to the newest paste.
| 1 | - | #include <iostream> |
| 1 | + | #include <stdio.h> |
| 2 | #include <time.h> | |
| 3 | #include <windows.h> | |
| 4 | ||
| 5 | - | using namespace std; |
| 5 | + | |
| 6 | {
| |
| 7 | srand(time(NULL)); | |
| 8 | bool f; | |
| 9 | int A[75]={0};
| |
| 10 | for (int i=0; i<75; i++) | |
| 11 | {
| |
| 12 | f=rand()%2; | |
| 13 | if (f) | |
| 14 | A[i]=rand()%21; | |
| 15 | else | |
| 16 | A[i]=(-1)*(rand()%6); | |
| 17 | } | |
| 18 | int x,y; | |
| 19 | int max=-6; | |
| 20 | for (int i=0; i<75; i++) | |
| 21 | for (int j=0; j<75; j++) | |
| 22 | if (A[i]-A[j]>max) | |
| 23 | {
| |
| 24 | x=i; y=j; | |
| 25 | max=A[i]-A[j]; | |
| 26 | } | |
| 27 | printf("%d ",A[x]);
| |
| 28 | printf("%d ",A[y]);
| |
| 29 | - | cout<<A[x]<<" "<<A[y]<<" left-right= "<<A[x]-A[y]; |
| 29 | + | printf(" left-right= %d",A[x]-A[y]);
|
| 30 | return 0; | |
| 31 | } |