/* s programable rectifier */
#include "stdio.h" /* head file */
main() /* main function */
{
int n=0,i=0; /* define two vars */
int pcm[9]={0,1,2,3,4,5,6,7,8},pcm1[9]; /* define two arrays */
printf("the inatialize of the pcm is :\n");
for(;i {
printf("%d,",pcm[i]);
}
i=0; /* recorver i value */
/* get the new value of the output pcm1 */
here:
printf("\n now,%d time is coming,please enter the way the data to go.",i+1);
n=(getchar()-48); /* getchar derive asc code ,char ,so ,need to decrease 48,to */ /* change to D */
getchar(); /* derive the \n */
/* printf("%d,",n); */
pcm1[n]=pcm[i]; /* message passes cm to go to new output pcm */
i++; /* i add 1 */
/* output the new value of the output pcm */
if (i>=9)
{
printf("\nafter CM ,the new value of the pcm is:\n ");
for (i=0;i {
printf("%d,",pcm1[i]);
}
exit(0); /* exit the program */
}
goto here; /* if i=9 */
}