写一个函数讲一个字符串使用特定的分隔符分割后输出
#include <stdio.h> int main(){ char* p = NULL; char s[100] ; int i = 0; scanf("%s",s); p = s; printf("%s\n",p); char a ; int count = 0 ; while((a = *p++) !='\0'){ if(a ==':'){ count++; } } p = s; int count1 = 0;
while((a = *p++)!='\0'){ i++; if(a == ':'){ count1++; int j ; for(j = -i; j < -1 ; ++j){ printf("%c",p[j]); } printf("\n"); if(count == count1){ printf("%s\n",p); return 0; } i = 0; } } }