C语言基础知识-程序流程结构

                                      作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.概述

C语言支持最基本的三种程序运行结构:顺序结构,选择结构,循环结构。
  顺序结构:程序按顺序执行,不发生跳转。
  选择结构:依据是否满足条件,有选择的执行相应功能。
  循环结构:依据条件是否满足,循环多次执行某段代码。

二.选择结构

1>.if语句

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat if_demo.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #include <stdio.h> int main(void)
{
int a = ;
int b = ;
if (a > b)
{
printf("a > b\n");
} return ;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o if_demo if_demo.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./if_demo
a > b
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

2>.if ... else语句

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat if_demo2.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #include <stdio.h> int main(void)
{
int a = ;
int b = ;
if (a > b)
{
printf("a > b\n");
}
else
{
printf("a < b\n");
} return ;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o if_demo2 if_demo2.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./if_demo2
a < b
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

3>.if ... else if ...else语句

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat if_demo3.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #include <stdio.h> int main(void)
{
int a = ;
int b = ;
if (a > b)
{
printf("a > b\n");
}
else if(a == b)
{
printf("a == b\n");
}
else
{
printf("a < b\n");
} return ;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o if_demo3 if_demo3.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./if_demo3
a == b
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

4>.三目运算符【其实其内部判断条件和if相似,语法结构简单明了

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat if_demo4.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #include <stdio.h> int main(void)
{
int a = ;
int b = ;
int max; if (a > b)
{
max = a;
}
else
{
max = b;
}
printf("s1 = %d\n",max); a = ;
b = ;
max = (a > b ? a:b);      //上面一大堆代码,我们仅仅用三目运算符一行简写。三目运算符格式为"表达式?选项1[表达式]:选项2",即如果表达式为真,选择选项1的结果,如果为假则选择新选项2。
printf("s2 = %d\n",max); return ;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o if_demo4 if_demo4.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./if_demo4
s1 =
s2 =
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

5>.switch语句【注意:if 条件语句执行效率差,switch条件语句执行效率相对较高,但是if可以判断一个区间,而switch则只能用来判断一个值】

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat switch_demo.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #include <stdio.h> int main(void)
{
char c;
c = getchar(); //注意该方法只会接收第一个字符哟~比如你输入的是100,它只会接收第一个字符“1” switch(c) //参数只能是整型变量
{
case '':
printf("OK\n");
break; //switch遇到break就中断了
case '':
printf("not OK\n");
break;
default: //如果上面的条件都不满足,那么执行default
printf("are u OK?\n");
} return ;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o switch_demo switch_demo.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./switch_demo OK
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./switch_demo not OK
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./switch_demo are u OK?
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./switch_demo are u OK?
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

三.循环结构

1>.while语句

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat while_demo.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h> int main(void)
{
int a = ;
while(a < )
{
printf("a = %d\n",a);
a++;
system("sleep 0.5");
}
printf("程序执行完毕~\n"); return EXIT_SUCCESS;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o while_demo while_demo.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./while_demo
a =
a =
a =
a =
a =
a =
a =
a =
a =
程序执行完毕~
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

2>.do ... while语句

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat narcissus.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h> int main(void)
{
int index = ;
do
{
int one = , ten=, hundred=; //将一个三位数分解个位,十位,百位 hundred = index / ; //百位 ten = index / % ; //十位 one = index % ; //个位 if (hundred * hundred * hundred + ten * ten * ten + one * one * one == index) //各个位数的立方和等于该数本身,那么它就是一个水仙花
{
printf("%d是水仙花数\n",index);
} index ++;
}while(index < ); return EXIT_SUCCESS;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o narcissus narcissus.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./narcissus
153是水仙花数
370是水仙花数
371是水仙花数
407是水仙花数
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

3>.for循环

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat for_demo.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h> int main(void)
{
int index = ;
int sum = ; for(index = ;index<=;index++) //计算0-100之间所有数字的是总和
{
sum += index;
} printf("sum = %d\n",sum); return EXIT_SUCCESS;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o for_demo for_demo.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./for_demo
sum =
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat for_demo2.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h> int main(void)
{
for(int i = ;i<;i++)
{
int one = , ten=, hundred=; //将一个三位数分解个位,十位,百位 hundred = i / ; //百位 ten = i / % ; //十位 one = i % ; //个位 if (hundred * hundred * hundred + ten * ten * ten + one * one * one == i) //各个位数的立方和等于该数本身,那么它就是一个水仙花
{
printf("%d是水仙花数\n",i);
}
}
return EXIT_SUCCESS;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o for_demo2 for_demo2.c -std=c99 #注意,在Linux系统我们编译for循环代码时需要指定"-std=c99",否则会报错"error: ‘for’ loop initial declarations are only allowed in C99 mode"
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./for_demo2
153是水仙花数
370是水仙花数
371是水仙花数
407是水仙花数
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

使用for循环打印三位数存在的水仙花数字

4>.嵌套循环(循环之间可以相互嵌套)

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat for_99.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h> int main(void)
{
int i,j;    #我们提前声明了变量i和j,如果我们在这里不声明直接在for循环里面声明也是可以的,只不过在Linux操作系统编译时,我们需要指定std的库为c99,默认使用的是c90库。否则会报错"error: ‘for’ loop initial declarations are only allowed in C99 mode"
for(i = ; i <= ; i++)
{
for(j=; j<=i; j++)
{
printf("%d x %d = %d\t",i,j,i * j);
}
printf("\n");
}
return EXIT_SUCCESS;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o for_99 for_99.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./for_99
x =
x = x =
x = x = x =
x = x = x = x =
x = x = x = x = x =
x = x = x = x = x = x =
x = x = x = x = x = x = x =
x = x = x = x = x = x = x = x =
x = x = x = x = x = x = x = x = x =
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

 5>.循环语句练习一(猜年龄)

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat guess_age.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #include <stdio.h>
#include <time.h> int main(void)
{
srand((unsigned int)time(NULL)); //加入随机数种子
int num = rand()% + ;
int value;
for(;;)
{
printf("猜猜看我年龄多大(请输入一个整数)>>>: ");
scanf("%d",&value);
if(value > num)
{
printf("我有那么老吗?\n");
}
else if(value < num)
{
printf("我看起来这么小吗?\n");
}
else
{
printf("太棒了,你猜对啦~\n");
break;
}
}
return ;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o guess_age guess_age.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./guess_age
猜猜看我年龄多大(请输入一个整数)>>>:
我看起来这么小吗?
猜猜看我年龄多大(请输入一个整数)>>>:
我有那么老吗?
猜猜看我年龄多大(请输入一个整数)>>>:
我有那么老吗?
猜猜看我年龄多大(请输入一个整数)>>>:
我看起来这么小吗?
猜猜看我年龄多大(请输入一个整数)>>>:
我有那么老吗?
猜猜看我年龄多大(请输入一个整数)>>>:
我看起来这么小吗?
猜猜看我年龄多大(请输入一个整数)>>>:
太棒了,你猜对啦~
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

 6>.循环语句练习二(打印等腰三角形)

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat isosceles_triangle.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #include <stdio.h> int main(void)
{
int row;
printf("请输入要打印等腰三角形的行数:>>> ");
scanf("%d",&row);
for (int i = ;i <= row;i++)
{
for (int j =;j <= row - i;j++)
{
printf(" ");
} for (int k = ;k <= i * -;k++)
{
printf("*");
}
printf("\n");
}
return ;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o isosceles_triangle isosceles_triangle.c -std=c99
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./isosceles_triangle
请输入要打印等腰三角形的行数:>>>
*
***
*****
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./isosceles_triangle
请输入要打印等腰三角形的行数:>>>
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

四.跳转语句break和contiune语句

1>.break语句

  在switch条件语句和循环语句中都可以使用break语句:
    当它出现在switch条件语句时,作用是终止某个case并跳出switch结构。
    当它出现在循环语句中,作用是跳出当前内循环语句,执行后面的代码。
    当它出现嵌套循环语句中,跳出最近的内层循环语句,执行后面的代码。
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat do_while.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h> int main(void)
{
int a = ;
do
{
a++;
if (a == )
{
break;
}
}while(a); //需要注意的是,尽管没有上面的if条件判断语句,该循环并非死循环,只是执行的次数较多而已,因为a是一个有符号int类型的数字,而int类型是有上限的 printf("%d\n",a); return EXIT_SUCCESS;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o do_while do_while.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./do_while [root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat do_while.c

2>.continue语句

  在循环语句中,如果希望立即终止本次循环,并执行下一次循环,此时就需要使用continue语句。
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat continue_demo.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h> int main(void)
{
int index = ;
while (index < )
{
index++;
if(index % == || index % == || index / == ) //过滤掉带7和7的倍数的数字
{
continue;
}
printf("数字:%d\n",index);
} return EXIT_SUCCESS;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o continue_demo continue_demo.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./continue_demo
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
数字:
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat continue_demo.c #过滤掉带7和7的倍数的数字

 3>.goto语句(无条件跳转,尽量少用)

[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# cat goto_demo.c
/*
@author :yinzhengjie
blog:http://www.cnblogs.com/yinzhengjie
EMAIL:y1053419035@qq.com
*/ #include <stdio.h> int main(void)
{
goto END; //无条件跳转到END的标识
printf("第一行字母:a\n"); END: //我们定义的END标识,需要注意的是,这里是冒号(":"),而非分号(“;”)哟~
printf("第二行字母:A\n"); return ;
}
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# gcc -o goto_demo goto_demo.c
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]# ./goto_demo
第二行字母:A
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#
[root@node101.yinzhengjie.org.cn /yinzhengjie/code/day002]#

C语言基础知识-程序流程结构的更多相关文章

  1. Golang 入门系列(三)Go语言基础知识汇总

    前面已经了 Go 环境的配置和初学Go时,容易遇到的坑,大家可以请查看前面的文章 https://www.cnblogs.com/zhangweizhong/category/1275863.html ...

  2. C语言基础知识-数组和字符串

    C语言基础知识-数组和字符串 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.数组概述 在程序设计中,为了方便处理数据把具有相同类型的若干变量按有序形式组织起来的方式我们称为数组 ...

  3. PHP丨PHP基础知识之流程控制WHILE循环「理论篇」

    昨天讲完FOR循环今天来讲讲他的兄弟WHILE循环!进入正题: while是计算机的一种基本循环模式.当满足条件时进入循环,进入循环后,当条件不满足时,跳出循环.while语句的一般表达式为:whil ...

  4. C语言基础知识-数据类型

    C语言基础知识-数据类型 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.常量与变量 1>.关键字 C的关键字共有32个. >.数据类型关键字(12个) char,s ...

  5. OC语言基础知识

    OC语言基础知识 一.面向对象 OC语言是面向对象的,c语言是面向过程的,面向对象和面向过程只是解决问题的两种思考方式,面向过程关注的是解决问题涉及的步骤,面向对象关注的是设计能够实现解决问题所需功能 ...

  6. 李洪强iOS开发之OC语言基础知识

    OC语言基础知识 一.面向对象 OC语言是面向对象的,c语言是面向过程的,面向对象和面向过程只是解决问题的两种思考方式,面向过程关注的是解决问题涉及的步骤,面向对象关注的是设计能够实现解决问题所需功能 ...

  7. ios开发学习笔记001-C语言基础知识

    先来学习一下C语言基础知识,总结如下: 在xcode下编写代码. 1.编写代码 2.编译:cc –c 文件名.c 编译成功会生成一个 .o的目标文件 3.链接:把目标文件.o和系统自带的库合并在一起, ...

  8. C语言基础知识-运算符与表达式

    C语言基础知识-运算符与表达式 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.常用运算符分类 1>.算术运算符 用于处理四则运算. 2>.赋值运算符 用于将表达式的 ...

  9. PHP语言基础知识

    目录 前言 第一章 PHP语言学习介绍 1.1 PHP部署安装环境 1.2 PHP代码工具选择 第二章 PHP代码基本语法 2.1 PHP函数知识介绍 2.2 PHP常量变量介绍 2.2.1 PHP变 ...

随机推荐

  1. JAVA中生成指定位数随机数的方法总结

    JAVA中生成指定位数随机数的方法很多,下面列举几种比较常用的方法. 方法一.通过Math类 public static String getRandom1(int len) { int rs = ( ...

  2. [转帖]【ZOOKEEPER系列】Paxos、Raft、ZAB

    [ZOOKEEPER系列]Paxos.Raft.ZAB 2018-07-11 12:09:49 wangzy-nice 阅读数 2428更多 分类专栏: zookeeper   版权声明:本文为博主原 ...

  3. 文件和异常的练习3——python编程从入门到实践

    10-10 常见单词:访问项目Gutenberg(http://gutenberg.org/),并找一些你想分析的图书.下载这些作品的文本文件或将浏览器中的原始文本复制到文本文件中. 可以使用coun ...

  4. python3 安装 pyinstaller 时报错的解决办法

    如上图所示,在安装的过程中发现是所关联的一个 future模块安装失败,庵后我有单独安装了一下这个future,发现还是失败 然后在网上寻找解决办法,最后找到了这个指令,pip install fut ...

  5. 网格搜索与K近邻中更多的超参数

    目录 网格搜索与K近邻中更多的超参数 一.knn网格搜索超参寻优 二.更多距离的定义 1.向量空间余弦相似度 2.调整余弦相似度 3.皮尔森相关系数 4.杰卡德相似系数 网格搜索与K近邻中更多的超参数 ...

  6. SQL注入获取Sa账号密码

    漏洞位置:http://168.1.1.81/Information/Search?Keyword=1111 漏洞利用: MSSQL 2000 http://168.1.1.81/Informatio ...

  7. aop 打印请求信息

    项目中使用 AOP 打印请求信息,打印响应信息.package com.example.aspect; import com.alibaba.fastjson.JSON;import com.goog ...

  8. C# 读取Oracle数据库视图数据异常问题处理

    会出现类似现在这种提示的错误 System.Data.OracleClient 需要 Oracle 客户端软件 version 8.1.7 或更高版本 情况1.开发过程中遇到这种问题解决 由于.net ...

  9. (转)微服务_创建一个简单的Eureka注册中心

    原文地址:https://www.cnblogs.com/lplshermie/p/9105329.html 微服务和分布式已经成了一种极其普遍的技术,为了跟上时代的步伐,最近开始着手学习Spring ...

  10. JS前端加密JAVA后端解密详解

    最近有一个加解密的需求,其实没有什么难度,但是实践过程中踩了很多坑,把踩坑过程分享出来. 1.前端JS加密 /** * 加密(需要先加载aes.min.js文件) * @param word * @r ...