分类:逗号分隔
C之scanf输入多个数字只能以逗号分隔,而不能用空格TAB空白符分隔#include<stdio.h>intmain(){intnum_max(intx,inty,intz);inta,b,c,max;scanf("%d,%d,%d",&a,&b,&c);max=num_max(a,b,c);printf("max=%d",max);return0;}intnum_max(intx,inty,intz){intmax=z;if(max<x)max=x;if(max<y)max=y;return(max);}原因是scanf对于数字输入,会忽略输入数据项前面的空白字符。因此只能以逗号分隔。补充知识:c...
继续阅读 >
1例如:要把如图1的字段拆分图2selectaccount_id,substring_index(substring_index(a.related_shop_ids,',',b.help_topic_id+1),',',-1)shopidfromsales_hang_accountajoinmysql.help_topicbonb.help_topic_id<(length(a.related_shop_ids)-length(replace(a.related_shop_ids,',',''))+1)orderbya.account_id2:然后和shops表进行连接查询取出我们需要的字段,我这里需要取出nameselect...
继续阅读 >