Advertisement
MochaGovno

2 massive (*)

May 23rd, 2013
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. 2 massive (*)
  2. #include <stdio.h>
  3. main()
  4. {
  5.     int i,j,*p,buf,
  6.         a[5][5]={3,5,6,7,8,
  7.                       5,7,3,2,1,
  8.                       2,1,4,8,3,
  9.                       5,6,9,1,3,
  10.                       7,2,3,4,6};
  11.  
  12.     printf("Dano A:\n");
  13.     for (i=0,p=&a[0][0];i<=20;i+=5)
  14.         {
  15.             for (j=0;j<=4;j++)
  16.                 printf("%3d",*(p+i+j));
  17.             printf("\n");
  18.         }
  19.  
  20.     for (i=0;i<=4;i++)
  21.         {
  22.             for (j=0,p=&a[i][0];j<=4;j++)
  23.                 if  (*p<a[i][j])
  24.                     p=&a[i][j];
  25.  
  26.             buf=a[i][0];
  27.             a[i][0]=*p;
  28.             *p=buf;
  29.         }
  30.  
  31.     printf("\nDano A:\n");
  32.     for (i=0,p=&a[0][0];i<=20;i+=5)
  33.         {
  34.             for (j=0;j<=4;j++)
  35.                 printf("%3d",*(p+i+j));
  36.             printf("\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement