木泓桑
木泓桑
关注数: 2
粉丝数: 0
发帖数: 39
关注贴吧数: 1
这个哪儿有问题? #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { char str1[101]={0},str2[51]={0}; char *p1,*p2=str2; printf("请输入第一个字符串:"); scanf("%s",str1); printf("请输入第二个字符串:"); scanf("%s",str2); p1=&str1[strlen(str1)]; while(p2!=NULL) { *(p1)=*(p2); p1++;p2++; } *(p1)='\0'; printf("%s",str1); getch(); }
希望前辈能帮忙解答一下,我实在不懂这个问题 struct Child { float height; float weight; int age; char gender; struct Child *next; }; void inputChild(struct Child *child) { printf("Age:");scanf("%d",&child->age); printf("Height:");scanf("%f",&child->height); printf("Weight:");scanf("%f",&child->weight); printf("Gender:");scanf("%s",&child->gender); } 最后一行的scanf,如果格式声明为“%c”就会被跳过,但是声明为“%s”则可以正常输入,请问这是为什么?(我的IDE是codeblocks)
1
下一页