-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecu_print.c
64 lines (59 loc) · 1.08 KB
/
recu_print.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include<stdlib.h>
#include<stdio.h>
#include<assert.h>
#include<string.h>
void printstr(char *data)
{
char *p=data,*q=NULL,*tmp=NULL;
int coun=0;
while(*p!='\0')
p++;
q=p;
assert(*p=='\0');
while(q!=NULL)
{
while((q!=data)&&(*q!=','))
q--;
if(*q==',')
tmp=q+1;
else
{
tmp=q;
q=NULL;
}
if(coun!=0)
printf(",");
while(tmp<p)
{
if(*p=='\0')
{
if(*tmp!='0')
{
printf("%c",*tmp);
coun++;
}
tmp++;
}
else
{
coun++;
printf("%c",*tmp);
tmp++;
}
}
p=q;
if(q!=NULL)
q--;
}
}
int main()
{
char *data="41,0,41,1,1,41,0";
char *data2="1,0,14,0,0,0,0,0,41";
//printf("%s\n",data);
printstr(data);
printf("\n");
printstr(data2);
printf("\n");
return 0;
}