- 博客(21)
- 收藏
- 关注
转载 小白入门_老九(C++入门)P63~65
#include iostream #include <cmath #include <iomanip #include <windows.h #include <cstdlib #include <string #include <ctime #include <vector #include <algorithm //sort算法的头文件 usi...
2019-07-12 16:07:25
119
转载 小白入门_老九(C++入门)P53~55
#include “iostream“ #include “cmath“ #include “iomanip“ #include “windows.h“ #include “cstdlib“ #include “string“ #include “ctime“ #include “vector“ #include “algorithm“ //sort算法的头文件 using namespace s...
2019-07-11 17:03:00
163
转载 小白入门_老九(C++入门)P46~52
#include #include #include #include <windows.h> #include #include #include using namespace std; //冒泡排序和选择排序 int main() { int temp; int nums[] = { 8,4,2,1,23,23,344,12 }; int numslen = size...
2019-07-11 15:05:00
200
转载 小白入门_老九(C++入门)P42~46
#include #include #include #include <windows.h> #include #include #include using namespace std; int main() { //外层循环控制行数(行数和换行) //内层循环控制列数(列数和图像) for (int i = 0; i < 3; i++) { for (int j...
2019-07-10 22:07:58
166
转载 小白入门_老九(C++入门)P36~42
1# include 2# include 3# include 4# include <windows.h> 5# include 6# include 7#include usin g namespace std; int main() { int sum = 0; for (int i = 0; i <= 100; i++) { if (i % 2 != 0) ...
2019-07-10 21:19:33
207
转载 小白入门_老九(C++入门)P1~35
1#提示没有与这些操作数匹配的运算符 最后解决,少了头文件#include LINK : fatal error LNK1168: 无法打开 …exe或者…dll进行写入的问题 看下后天是不是有没有窗口没有关闭; #include #include #include #include <windows.h> #include using namespace std; #inc...
2019-07-09 20:25:28
299
转载 小白入门_python菜鸟100题(26-30)
26#利用递归方法求5!。 函数自己调用自己的递归= def jiech(num): sum = 0 if num == 0: sum = 1 else: sum = num * jiech(num - 1) return sum print(jiech(4)) 27# 利用递归函数调用方式,将所输入的5个字符,以相反顺序打印出来。 input([prompt]) 原理上input()是一个特...
2019-07-06 16:49:16
230
转载 小白入门_python菜鸟100题(21-25)
21 # 猴子吃桃问题 x = 1 for i in range(9, 0, -1): x = (x+1)*2 print(“第”, i, “天的pich有”, x, “个”) 22# 两个乒乓球队进行比赛,各出 妙啊妙啊 for a in [‘x’, ‘y’, ‘z’]: for b in [‘x’, ‘y’, ‘z’]: for c in [‘x’, ‘y’, ‘z’]: if (a!=b)...
2019-07-04 22:27:58
298
转载 小白入门_python菜鸟100题(16-20)
16 # 输出指定日期格式的 import datetime if name == ‘main’: print(datetime.date.today().strftime(’%d/%m/%Y’)) date1 = datetime.date(1941, 1, 5) print(date1.strftime(’%d/%m/%Y’)) date2 = date1 + datetime.timede...
2019-07-03 16:09:32
655
转载 小白入门_python菜鸟100题(11-15)
11# 有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? 0 # 斐波那契数列 a = 0 b = 1 for i in range(42): a, b = b, a+b print(a) 12# 判断101-200之间有多少个素数,并输出所有素数。 程序分析:判断素数的方法:用一个数分别去除2到sqrt(这个数...
2019-07-03 12:27:57
189
转载 小白入门_python菜鸟100题(6~10)
6 # 斐波那契数列,关键在 a,b =b,a+b def fib(n): a = 0 b = 1 for i in range(n): a, b = b, a+b print(a) fib(12) 7# 输出99乘数表格 for i in range(1, 10): print() for j in range(1, i+1): x = ij print(i, "", j, “=”, x,...
2019-07-02 20:00:25
243
转载 小白入门_python菜鸟100题(1~5)
1#1,2,3,4,组成各不相同的三位数 for i in range(1, 5): for j in range(1, 5): for k in range(1, 5): if(i != j) and (i != k) and (j != k): s = 100i+10j+k print(s) print(i, j, k) 2# 企业利润 这个思想很重要,采用数轴的方式,而不是很蠢的用if e...
2019-07-02 19:11:05
392
转载 转 小白入门Python-第2课
问题转载于做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)? 分为三个部分: 1.通过ascii码去获得一组包含所有字母和数字的字符串list=[a~z,A-Z,1-9] 【str(chr(x)】将ascii的x转换为chr,然后替换成str 2.利用random的函数的choic...
2019-07-02 12:24:17
133
转载 小白入门Python-第一课
小白入门Python 第一道题目,在图片上加上数字,来自于https://github.com/Yixiaohan/show-me-the-code 主要的流程分为: 1.首先读入一张图片,注意选择合适的格式,后面一律采用该格式进行保存操作 img=Image.open(“pic”) (这里用到的是PIL的库,注意看函数提示) 2.然后选择自己合适的字体和大小,利用ImageFont.truety...
2019-07-02 11:03:24
194
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人