#include main() { int k ,v1=0,v2=0,v3=0,v4=0; char s[]="12134211"; for(k=0;s[k];k++)#include main(){ int k ,v1=0,v2=0,v3=0,v4=0; char s[]="12134211"; for(k=0;s[k];k++) switch(s[k]) { default: v4++; case 1: v1++; case 2: v2++; case 3

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 07:46:16
#includemain(){intk,v1=0,v2=0,v3=0,v4=0;chars[]="12134211";for(k=0;s[k];k++)#includemain(){intk,v1=0

#include main() { int k ,v1=0,v2=0,v3=0,v4=0; char s[]="12134211"; for(k=0;s[k];k++)#include main(){ int k ,v1=0,v2=0,v3=0,v4=0; char s[]="12134211"; for(k=0;s[k];k++) switch(s[k]) { default: v4++; case 1: v1++; case 2: v2++; case 3
#include main() { int k ,v1=0,v2=0,v3=0,v4=0; char s[]="12134211"; for(k=0;s[k];k++)
#include
main()
{
int k ,v1=0,v2=0,v3=0,v4=0;
char s[]="12134211";
for(k=0;s[k];k++)
switch(s[k])
{
default:
v4++;
case 1:
v1++;
case 2:
v2++;
case 3:
v3++;
}
printf("%d,%d,%d,%d",v1,v2,v3,v4);
} 的运行结果为什么是 8 8 8 8

#include main() { int k ,v1=0,v2=0,v3=0,v4=0; char s[]="12134211"; for(k=0;s[k];k++)#include main(){ int k ,v1=0,v2=0,v3=0,v4=0; char s[]="12134211"; for(k=0;s[k];k++) switch(s[k]) { default: v4++; case 1: v1++; case 2: v2++; case 3
switch语句以下写错了
这样写:
switch(s[k])
{
case '1':
v1++;break;
case '2':
v2++;break;
case '3':
v3++;break;
default:
v4++;break;
}