1.switch多分支结构 import java.util.Scanner; public class Test1{ public static void main(String[] args){ Scanner in=new Scanner(System.in); System.out.println("请输入你的名次:"); int num1=in.nextInt(); switch(num1){ case 1: System.out.println("武林盟主&quo…
if语句和三元运算符的互换 在某些简单的应用中,if语句是可以和三元运算符互换使用的 public static void main(String[] args) { int a = 10; int b = 20; //定义变量,保存a和b的较大值 int c; if(a > b) { c = a; } else { c = b; } //可以上述功能改写为三元运算符形式 c = a > b ? a:b; } 选择语句--switch switch语句格式: switch(表达式) { cas…
for循环: ; i < ; i++) { Console.WriteLine("执行"+i+"次"); } while循环: while (true) { Console.WriteLine("条件为永真"); } do while循环: do { Console.WriteLine("每次都执行的区域"); } while (false); 例:小明在10天中每天锻炼跑步3850米,十天后共跑了多少米. ; i &l…
总结一下常用的if else与switch,其中switch中的break知识点是笔试题经常考到的内容. if else与else if 在C语言中,经常使用if else选择语句,来实现很多对应的功能,此部分简单易学,却是基础中的基础.特记录一下,供像我当初一样学编程迷茫的初学者参考. 一 直接使用if-else语句 int num;scanf("%d",&num)if(num==1){ printf("you input is 1\n");}else…
基础语句 CREATE DROP 建表.删表 建表 -------------------------------------- -- 1. 直接建表 -------------------------------------- -- 创建非分区表时,省去后半部分即可 create table if not exists table_name( id string comment 'id ', num string comment '数值' ) partitioned by ( ym strin…
根据传入条件的不同,选择语句会执行不同的语句.下面的例子根据传入的整型变量i的不同而打印不同的内容: switch i { case 0: fmt.Printf("0") case 1: fmt.Printf("1") case 2: fallthrough case 3: fmt.Printf("3") case 4, 5, 6: fmt.Printf("4, 5, 6") default: fmt.Printf("…
php PHP-enabled web pages are treated just like regular HTML pages and you can create and edit them the same way you normally create regular HTML pages.(像html一样被编辑) PHP 能够生成动态页面内容PHP 能够创建.打开.读取.写入.删除以及关闭服务器上的文件PHP 能够接收表单数据PHP 能够发送并取回 cookiesPHP 能够添加.…