随笔分类 -  c/c++

摘要:这里的第一个算法,没什么可以说的,一定是从最经典的冒泡算法开始,会列出python版和c版 冒泡算法很简单,就是像冒泡一样,把小的,也可以理解成轻的,从下面浮出来 比如有个list = [3,2,5,4,1],先用3和2比,2轻,2浮上去,3沉下去,3再和5比,3比较轻,位置不变,5和4比,4浮上来 阅读全文
posted @ 2018-02-03 00:55 咻_python 阅读(440) 评论(0) 推荐(0) 编辑
摘要:strlen() 获取字符串长度 #include <stdio.h> #include <string.h> char a[] = "abcde"; printf("%d \n", strlen(a)); //结果5 scanf() //可以自己输入一段XXX到程序变量,如果输入中包含空格,则变量 阅读全文
posted @ 2018-01-28 16:30 咻_python 阅读(166) 评论(0) 推荐(0) 编辑
摘要:#include <assert.h> //设定插入点#include <ctype.h> //字符处理#include <errno.h> //定义错误码#include <float.h> //浮点数处理#include <fstream.h> //文件输入/输出#include <iomani 阅读全文
posted @ 2018-01-13 00:03 咻_python 阅读(481) 评论(0) 推荐(0) 编辑
摘要:定义变量 int i; 也可以 int i,num; 赋值,c必须先定义变量再赋值 num = 0; 循环for for(i=1; i<=0; i++) { printf("%d \n", i); #不解释,和python用法差不多 } 循环while while(i<=10) { printf(" 阅读全文
posted @ 2018-01-13 00:02 咻_python 阅读(201) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示