摘要: #include<stdio.h> #include<stdlib.h> #include<time.h> void bubble(int* p, int n); void choose(int* p, int n); void del(int* p, int na, int m, int l); 阅读全文
posted @ 2020-12-16 19:43 清歌留欢 阅读(23) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> int main() { int a[2]={1,2},*p=a; printf("%d\n",*p++); //等于1 printf("%d\n",(*p)++); //等于1 printf("%d\n",*++p); //等于2 printf("%d\n",+ 阅读全文
posted @ 2020-12-14 19:14 清歌留欢 阅读(251) 评论(0) 推荐(0) 编辑
摘要: import numpy as np; import math; #构造矩阵 m = np.mat([[1,2,3,4],[2,2,3,4],[3,2,3,4],[4,2,3,4]]); print(m); #取第i行,从0开始计数 row1 = m[0]; print(row1); #取[i,j] 阅读全文
posted @ 2020-12-13 16:39 清歌留欢 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Matplotlib 安装 sudo pip install matplotlib 绘制图像、点和线 form PIL import Image from pylab import * # 读取图像到数组中 im = array(Image.open('filename.jpg')) # 绘制图像 阅读全文
posted @ 2020-12-13 16:37 清歌留欢 阅读(119) 评论(0) 推荐(0) 编辑
摘要: PIL:Python图像处理类库 PIL安装 sudo apt install python-pip # 安装pip sudo pip install pillow 读取一幅图像 读取一幅图像 from PIL import Image im = Image.open('filename.jpg') 阅读全文
posted @ 2020-12-13 16:32 清歌留欢 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 所谓数组,是有序的元素序列。若将有限个类型相同的变量的集合命名,那么这个名称为数组名。组成数组的各个变量称为数组的分量,也称为数组的元素,有时也称为下标变量。用于区分数组的各个元素的数字编号称为下标。数组是在程序设计中,为了处理方便, 把具有相同类型的若干元素按无序的形式组织起来的一种形式。这些无序 阅读全文
posted @ 2020-11-24 22:12 清歌留欢 阅读(82) 评论(0) 推荐(0) 编辑
摘要: //第四题 #include<stdio.h> #include<time.h> #include<stdlib.h> int main() { int a, b; srand(time(0));//产生随机种子 a = rand(); b = rand();//随机生成a,b for (int i 阅读全文
posted @ 2020-11-22 22:37 清歌留欢 阅读(84) 评论(0) 推荐(0) 编辑
摘要: //第三题 #include<stdio.h> int main() { int a, b, c, d, i = 0; for (a = 0; a ⇐ 9; a++) { for (b = 0; b ⇐ 9; b++) { for (c = 0; c ⇐ 9; c++) { for (d = 0; 阅读全文
posted @ 2020-11-22 22:36 清歌留欢 阅读(26) 评论(0) 推荐(0) 编辑
摘要: //第二题 #include<stdio.h> int main() { int n = 1, i = 1, x = 0, line, k; char ch = 'A'; scanf("%d", &line);//输入上金字塔的行数 for (ch = 'A'; ch - 'A' ⇐ line - 阅读全文
posted @ 2020-11-22 22:35 清歌留欢 阅读(143) 评论(0) 推荐(0) 编辑
摘要: //第一题 #include<stdio.h> int main() { int i, j, sum, all; all = 0; for (i = 1; i ⇐ 50; i++) { sum = 0; for (j = 1; j ⇐ i; j++) { sum += j; } //计算1加到i的和 阅读全文
posted @ 2020-11-22 22:34 清歌留欢 阅读(56) 评论(0) 推荐(0) 编辑