#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/01 13:08:21
#include  main() { int k ,v1=0,v2=0,v3=0,v4=0; char s[]=
xRN@IMI`w{0#C)%4ڴBM4уcp)PORZBqDyUf;>{l) ؗ3f+ġ8WRx o%R%x,R$|q=! gn%އ]z=[==Y0?/W8;ܲﻘ8r0pFQ@Sx0 ekjcɆ%Y6Ӏhkv߫(b

#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;
}