C语言里的switch语句怎么用 最好有例子哈

瑶外婆 2个月前 已收到1个回答 举报

梦好甜 2星

共回答了278个问题采纳率:91.2% 评论

switch(表达式){ case 常量表达式1: 语句1; case 常量表达式2: 语句2; … case 常量表达式n: 语句n; default: 语句n+1;}//例子:int choice;scanf("%d", &choice)

;switch(choice){ case 0: operation0(); break; case 1: operation1(); break; default: operation_default();}

7小时前

30
可能相似的问题

热门问题推荐

Copyright © 2024 微短问答 All rights reserved. 粤ICP备2021119249号 站务邮箱 service@wdace.com