T
Tadpole
You might also have a look at clc faq question 13.19:
Your suggestion is absolutely brilliant.
It exactly solves my problem with only just a few programming lines. As
shown below: I shuffle 20 times.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main ()
{ int A[]= {0,1,2,3,4};
srand (time(NULL));
int x,y,z;
for (int i=0; i<20 ;i++)
{ x =rand()%5;
y =rand ()%5;
printf ("%d %d \n",x,y);
z= A[x];
A[x]=A[y];
A[y]=z;
}
printf ("\n");
for (int i=0; i<5; i++)
printf ("A[%d]= %d\n",i,A);
return 0;
}
Is there one "include" statement that I can write to substitute the 3 "
#include " statement in the header?
Meaning #include < XXX.h > where XXX represent the statement I am
searching for?
Rgds,
Khoon
Your suggestion is absolutely brilliant.
It exactly solves my problem with only just a few programming lines. As
shown below: I shuffle 20 times.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main ()
{ int A[]= {0,1,2,3,4};
srand (time(NULL));
int x,y,z;
for (int i=0; i<20 ;i++)
{ x =rand()%5;
y =rand ()%5;
printf ("%d %d \n",x,y);
z= A[x];
A[x]=A[y];
A[y]=z;
}
printf ("\n");
for (int i=0; i<5; i++)
printf ("A[%d]= %d\n",i,A);
return 0;
}
Is there one "include" statement that I can write to substitute the 3 "
#include " statement in the header?
Meaning #include < XXX.h > where XXX represent the statement I am
searching for?
Rgds,
Khoon