码迷,mamicode.com
首页 >  
搜索关键字:elseif    ( 492个结果
编写一个函数实现n^k,使用递归实现
#include<stdio.h> #include<stdlib.h> #include<assert.h> doublemy_pow(constdoublenumber,intn) { assert(number); if(n>0) { returnnumber*my_pow(number,n-1); } elseif(n<0) { return(1/number)*my_pow(number,n+1); } else retu..
分类:其他好文   时间:2015-11-25 01:17:11    阅读次数:175
freemarker常用的基本命令
if,else,elseif指令switch,case,default,break指令list,break指令include指令import 指令noparse指令compress指令escape,noescape指令assign 指令global 指令local 指令setting 指令用户自定义...
分类:其他好文   时间:2015-11-23 00:55:58    阅读次数:139
【C语言】【面试题】使用main函数的参数,实现一个整数计算机,程序可以接受三个参数
#define_CRT_SECURE_NO_WARNINGS1 #include<stdio.h> #include<stdlib.h> #include<assert.h> intint_computer(intnum1,char*p,intnum2) { if(p=="-a") returnnum1+num2; elseif(p=="-s") returnnum1-num2; elseif(p=="-m") returnnum1*num2; elseif(p=="-d"..
分类:编程语言   时间:2015-11-17 19:13:32    阅读次数:235
C语言:使用main函数的参数,实现一个整数计算机。
#include<stdio.h> #include<stdlib.h> #include<assert.h> intcalculator(intnum1,char*p,intnum2) { if(p=="-a") returnnum1+num2; elseif(p=="-s") returnnum1-num2; elseif(p=="-m") returnnum1*num2; elseif(p=="-d") returnnum1/num2; else return-1..
分类:编程语言   时间:2015-11-17 07:05:32    阅读次数:215
Lua编程入门-学习笔记1
第1章:起点Chunks: 语句块每个语句结尾的分号是可选的,如果同一行有多个语句最好使用分号分隔;dofile("lib1.lua") -- 执行lua文件全局变量:局部变量用local修饰,否则就是全局变量保留字: if then else elseif end and or not fucti...
分类:其他好文   时间:2015-11-15 23:22:04    阅读次数:237
实现n的k次方
#include<stdio.h>intmain(){doublefunction(intn,intk);inta=0;intb=0;doublec=0;scanf("%d%d",&a,&b);c=function(a,b);printf("%lf\n",c);system("pause");return0;}doublefunction(intn,intk){if(k==0)//k==0返回1{return1;}elseif(k>0)//k>0返回n的k次..
分类:其他好文   时间:2015-11-10 01:50:27    阅读次数:197
输入字符串,统计其中数字,空格和其他字符的个数
#define_CRT_SECURE_NO_WARNINGS#include<stdio.h>intmain(){chara;intnum=0;intspace=0;intother=0;while((a=getchar())!=‘\n‘){if((a>=‘0‘)&&(a<=‘9‘))num++;elseif(a==‘‘)space++;elseother++;}printf("%d%d%d",num,space,other);system("pause");retur..
分类:其他好文   时间:2015-11-01 19:37:57    阅读次数:149
用c语言实现折半查找函数
#include<stdio.h> #include<stdlib.h> intbinsearch(intx,intarr[],intleft,intright) { while(left<=right) { intmid=(left+right)/2; if(arr[mid]==x) { returnmid; } elseif(arr[mid]<x) { left=mid+1; } else { right=mid-1; } } return-1; } intmain()..
分类:编程语言   时间:2015-10-31 18:39:55    阅读次数:214
括号匹配问题
#include<stdio.h> intmain() { intcou=0; charch; while((ch=getchar())!=‘\n‘) { if(ch==‘{‘) cou++; elseif(ch==‘}‘) { if(cou==0) printf("匹配不成功!"); cou--; } } if(cou==0) printf("匹配成功!"); else printf("匹配不成功!"); return0; }
分类:其他好文   时间:2015-10-31 18:38:57    阅读次数:159
模板引擎smarty 二
条件判断语句(这些语句都是写在smarty模板中的) {if $name eq 'Tom'} Welcome Sir {elseif $name eq 'Wilma'} Welcome Ma'am {else} Welcome,whatever y...
分类:其他好文   时间:2015-10-31 15:44:51    阅读次数:235
492条   上一页 1 ... 30 31 32 33 34 ... 50 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!