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