0
点赞
收藏
分享

微信扫一扫

switch语法 C++版

witmy 2022-01-26 阅读 54


​switch​​语法 C++版

1.switch语法

好久没有写​​switch​​了,竟然还差点儿忘记了。<( ̄ ﹌  ̄)>

2.简单示例

#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
int type;
cin >> type;

switch(type){
case 1:cout <<"your input is 1\n"; break;
case 2:cout <<"your input is 2\n"; break;
default : cout <<"default\n";
}
}

3.执行结果

switch语法 C++版_c++



举报

相关推荐

0 条评论