1.
int l_v1=0;
scanf("%d",&l_v1);
prtinf("l_v1 is %d\n",l_v1);
system("pause")
2.
char l_name[20]={0};
int l_age=0;
scanf("%s%d", &l_name,&l_age);
printf("姓名:%s年龄:%d\n",l_name,l_age);
system("pause");
输入的时候tab,空格,回车
3.void main(){
char l_name[20]={0};
char l_city[20]={0};
scanf("%s%*d%*d%*s%*s%s",&l_name,&l_city);//*可以隐藏一些变量
pritnf("姓名:%s城市:%s\n",l_name,l_city);
system("pause");
}
4.
void main(){
int l_v1,l_v2,l_v3,l_v4,l_v5;
scanf("%3d%3d%3d%3d%3d",&l_v1,&l_v2,&l_v3,&l_v4,&l_v5)
5.
char l_v1 [20]={0};
char l_v2[20]={0};
scanf("%5s%5s",&l_v1,&l_v2);//逗号用法 scanf("%[^,]%s",&l_v1,&l_v2);
时间: 2024-10-28 20:40:00