码迷,mamicode.com
首页 >  
搜索关键字:if then else    ( 23991个结果
case表达式用法
1.两种格式: case表达式when表达式1THEN表达式1a【【when表达式2then表达式2a】【......】】------可以省略【else表达式N】 ------可以省略 END ;casewhen条件表达式1 then表达式1【【when条件表达式2then表达式2】【......】...
分类:其他好文   时间:2015-01-25 21:00:19    阅读次数:164
python实现算法题-汉诺塔
def hnoi(n,a,b,c):     if n == 1:         print a,c     else:         hnoi(n-1,a,c,b)         print a,c         hnoi(n-1,b,a,c) hnoi(3,'a','b','c')...
分类:编程语言   时间:2015-01-25 16:41:56    阅读次数:274
减少if语句的嵌套层次,提高代码的可读性
不合理示例: if v_type = -1 then   异常处理2 else if v_type = -2 then   异常处理2 else if v_type = 1 then    if v_size = -1 then       异常处理31    else if v_size = -2 then       异常处理31    else if v_size = 1...
分类:其他好文   时间:2015-01-25 12:35:28    阅读次数:135
hdu 1158 Employment Planning(DP)
题意:有一个工程需要N个月才能完成。(nk){ dd=(j-k)*hire; }else{ dd=(k-j)*fire; } ...
分类:其他好文   时间:2015-01-25 12:19:32    阅读次数:126
【PAT_Basic日记】1001. 害死人不偿命的(3n+1)猜想
还是觉得代码放这靠谱,会定期的看看和优化代码#include #include int main(){ int n; int count=0; scanf("%d",&n); if(n1000)exit(0); else { while(n!=1) ...
分类:其他好文   时间:2015-01-25 11:08:15    阅读次数:134
Python学习日记[1]
Day1:输入输出语句:input、print控制语句:if、else、elif…循环语句:for(类似于C#里面的foreach),while…type(), isinstance()…data type:int, float, bool, str…`operator:**, //,…列表:一个打...
分类:编程语言   时间:2015-01-25 11:06:54    阅读次数:219
Linux下利用fork()创建子进程并使父进程等待子进程结束
int status;pid_t t = fork();if(t){waitpid(t, &status, 0);}else{system("vi temp.txt");exit(0);}//父进程和子进程均执行完毕后继续执行下去分析过程:if和else还是选择分支。主要的原因是,fork()函数调...
分类:系统相关   时间:2015-01-24 11:27:03    阅读次数:170
windows和linux下获取当前程序路径以及cpu数
[cpp]view plaincopy#ifdefWIN32#include#else#include#include#endif#includestd::stringgetCurrentAppPath(){#ifdefWIN32charpath[MAX_PATH+1]={0};if(GetModu...
分类:Windows程序   时间:2015-01-24 10:04:00    阅读次数:263
linux学习之shell脚本 ------- 控制流结构
[本文是自己学习所做笔记,欢迎转载,但请注明出处:http://blog.csdn.net/jesson20121020] 今天开始学一些同其他高级语言一样的shell流控制结构 流控制语句:   1. if语句    语句格式:    if condition1 then command1 else condition2 then command2 else...
分类:系统相关   时间:2015-01-24 00:29:49    阅读次数:224
lua的local问题
1. 初识 使用Local带来错误。自己写了一个递归的函数,结果报错:local fLocal = function(n) if (n == 1) then return n; else return n + fLocal(n-1) endendpri...
分类:其他好文   时间:2015-01-23 21:31:14    阅读次数:232
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!