#include
int q1,q2,q3;
void fun(long n)
{
q1=q2=q3=0;
while(n)
{
switch(n%10)
{
case 1:q1++;break;
case 2:q2++;break;
case 3:q3++;
}
n/=10;
}
}
main()
{
long n=123451123;
fun(n);
...
分类:
其他好文 时间:
2014-07-24 23:04:43
阅读次数:
271
一直自以为还比较了解C++,这两天写个小工具结果出现了个bug,查了几个小时。现在才发现我这么水。switch是C++后来推出了,目的在于提高代码结构清晰度。但是switch与while连用时是有坑的。 1 #include 2 #include 3 4 int main() 5 { 6 ...
分类:
其他好文 时间:
2014-07-24 22:17:32
阅读次数:
236
switch(参数值){ case value: [default://可选 defaultStatements;]}参数值类型必须是这几种类型之一:int,byte,char,shortswitch为什么只能用int,short,byte,char,而不能用long,String呢?因为switc...
分类:
其他好文 时间:
2014-07-24 22:03:52
阅读次数:
209
switch ($p) { case 'home': case '': $current_home = 'current'; break; case 'users.online': case 'users.location': case ...
分类:
其他好文 时间:
2014-07-24 04:59:28
阅读次数:
292
webdriver中处理原生的js alert confirm 以及prompt是很简单的。具体思路是使用switch_to.alert()方法定位到alert/confirm/prompt。然后使用text /accept/dismiss/send_keys按需进行操做text。返回alert/c...
分类:
其他好文 时间:
2014-07-23 15:46:09
阅读次数:
261
场景处理frame需要用到2个方法,分别是switch_to_frame(name_or_id_or_frame_element)和switch_to_default_content()如何理解这个switch_to_frame(name_or_id_or_frame_element)方法呢?可以简...
分类:
其他好文 时间:
2014-07-23 15:40:59
阅读次数:
318
1. 变量提升: 只对var声明的变量有效。 2. 标识符:数字,下划线,unicode字母,数字不能开头。 3. switch与case的值比较使用严格相等=== 4.do{}while(); 记住加分号。 5. 标签top: 使用break top; 跳到标签 6.数据类型number,stri...
分类:
编程语言 时间:
2014-07-23 15:05:56
阅读次数:
208
//得到随机数function fRandomBy(under, over){ switch(arguments.length){ case 1: return parseInt(Math.random()*under+1); case 2: return parseInt(Math.random(...
分类:
Web程序 时间:
2014-07-22 22:46:12
阅读次数:
211
简单工厂模式的最大优点在于工厂类中包含了必要的逻辑判断,根据客户端的选择条件动态实例化相关的类,对于客户端来说,去除了与具体产品的依赖。例如在简单工厂模式中出现的工厂函数:
Operation* FactoryFunction(double left, double right, char op)
{
switch (op)
{
case '+':
ret...
分类:
其他好文 时间:
2014-07-22 22:38:56
阅读次数:
283
判断语句:ng-switch onng-switch-whenng-switch-whenng-if=”person.sex==1“you are a boyyou are a girl {{person.Name}} ...
分类:
Web程序 时间:
2014-07-22 22:36:13
阅读次数:
185