2 | #define M 20
3 | void fun(int *x,int n)
4 | {
5 | int *p,m=n/2,*i,*j;
6 | i=x;
7 | j=x+n-1;
8 | p=x+m;
9 | for(;i10)
22 | {
23 | for(r=1;r10)
26 | Digit++;
27 | Data[r+1]+=Data[r]/10;
28 | Data[r]=Data[r]%10;
29 | }
30 | }
31 | }
32 | printf("%d!= ",i);
33 | for(k=Digit;k>0;k--)
34 | printf("%d",Data[k]);
35 | printf("\n");
36 | }
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/数据结构算法实现(严蔚敏版配套实现程序)/ch01/1-19/CODE/1-19.c:
--------------------------------------------------------------------------------
1 | #include"stdio.h"
2 | int partition(char *s1,char *s2,int pos)
3 | {
4 | int i,j;
5 | i=pos;
6 | while(s1[i]==' ')
7 | i++;
8 | if(s1[i]!='\0')
9 | {
10 | j=0;
11 | while(s1[i]!='\0'&&s1[i]!=' ')
12 | {
13 | s2[j]=s1[i];
14 | i++;
15 | j++;
16 | }
17 | s2[j]='\0';
18 | return i;
19 | }
20 | else
21 | return -1;
22 | }
23 | void main()
24 | {
25 | char string[50];
26 | char partition_string[20];
27 | int position;
28 | int k;
29 | printf("\nPlease input strng:");
30 | gets(string);
31 | position=0;
32 | printf("\nPartition result:\n");
33 | k=0;
34 | while((position=partition(string,partition_string,position))!=-1)
35 | {
36 | k++;
37 | printf("Partition %d:%s\n",k,partition_string);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------