默认分类
文章平均质量分 68
Uncertainty!!
生存/生活--商品和服务--货币--物欲--价值观--人生观--世界观
展开
-
充分条件、必要条件、充要条件
简要理解充分条件、必要条件、充要条件原创 2022-10-01 11:30:51 · 1319 阅读 · 0 评论 -
为什么除数不能为0?
为什么除数不能为0?笔记来源:Dividing by zero?Multiplication is repeated adding3×5=5+5+55×3=3+3+3+3+33×5=5+5+5\\5×3=3+3+3+3+33×5=5+5+55×3=3+3+3+3+3Multiplication is repeated subtracting要将被除数减到0为止15÷5=3【15−5−5−5⏟3个=0,需要3个5】 15÷3=5【15−3−3−3−3−3⏟5个=0,需要5个原创 2022-01-22 19:40:17 · 323 阅读 · 0 评论 -
为什么0的阶乘=1、2的0次幂=1?
为什么 0!=1、2^0=1?笔记来源:Why is 0! = 1?0!=? 1!=1 2!=2 3!=6 4!=240!=?\\~\\1!=1\\~\\2!=2\\~\\3!=6\\~\\4!=240!=? 1!=1 2!=2 3!=6 4!=2420=? 21=2 22=4 23=8 24=162^0=?\\~\\2^1=2\\~\\2^2=4\\原创 2022-01-22 18:58:43 · 549 阅读 · 1 评论 -
Sverchok入门-第二节
Sverchok入门-第二节节点中点、边、面的具体数据,及其对应关系(数据索引)显示节点中数据索引使用mask列表表示元素的选择状态通过 mask 就可以对单独的元素进行控制指定多个索引数据来实现手动选择元素的功能True代表该数据被选中Logic function 提供各种逻辑功能节点...原创 2022-01-16 18:55:58 · 520 阅读 · 0 评论 -
Sverchok的简单入门操作
Sverchok的简单入门操作笔记来源:Sverchok Quickstart - 1 Basic Introduction打开Sverchok新建节点点击Add添加节点或快捷键(Shift+A)Alt+Space打开搜索菜单点击View->Frame All将视角移动到可以看见所有节点或快捷键(Home)Ctrl+Left Click 产生节点预览Ctrl+Right Click 显示节点具体数据Ctrl+Right Click 会删除节点间连线原创 2022-01-16 15:28:52 · 837 阅读 · 0 评论 -
控制树莓派GPIO点亮LED
控制树莓派GPIO点亮LED本篇博客参考来源ssh远程连接树莓派控制GPIO26进入GPIO26文件将GPIO26修改为输出模式GPIO26输出高电平注销GPIO26原创 2021-10-15 22:45:16 · 170 阅读 · 0 评论 -
树莓派安装rover-raspbian-buster-lite系统并进行初始配置
1.准备工作以下系统烧录操作在VMware虚拟机中在ubuntu内进行准备文件系统镜像:rover-raspbian-buster-lite烧录软件:balena-etcher-electron文件:RPI-Setup-master准备硬件树莓派4BSD cardHDMI线Type-C供电键盘、鼠标...原创 2021-09-24 12:41:59 · 485 阅读 · 0 评论 -
rosdep update gives “Website may be down“ on Melodic
It has to work for Ubuntu18.04https://www.fatalerrors.org/a/installation-of-ros-in-ubuntu-18.04.html原创 2021-06-04 15:53:22 · 162 阅读 · 1 评论 -
运动学逆解(四足机器狗)
以下公式推导参考:传送门机器狗结构设计参考:灯哥菠萝狗1.运动学正解与逆解含义2.求解肩部的旋转量 γ\gammaγ在yOz平面内与实际机器狗的腿部进行对照下图中直线的实际长度均为在平面yOz中的投影已知:y,z,h求解中间量:d,l,γ1,γ2d,l,\gamma_1,\gamma_2d,l,γ1,γ2求解最终量: γ\gammaγ求解过程:d=y2+z2 d=\sqrt{y^2+z^2} d=y2+z2l=d2−h2 l=\sqrt{d^2-h^2} l=d2−h2原创 2021-07-10 22:05:04 · 4284 阅读 · 2 评论 -
c++primer练习7.52、7.53、7.54、7.55、7.56、7.57、7.58
练习7.5264页的Sales_data类In my opinion, the aim of the problem is Aggregate Class(聚合类).Test-maker think that Sales_data is Aggregate Class, so Sales_data should have no in-class initializers if we want to initialize the data members of an aggregate class b原创 2021-04-27 22:17:45 · 487 阅读 · 2 评论 -
c++primer练习7.41、7.42、7.43、7.44、7.45、7.46、7.47、7.48、7.49、7.50
练习7.41#ifndef ex7_41_H#define ex7_41_H#include <string>#include <iostream>//类声明class Sales_data;//函数声明std::istream &read(std::istream &, Sales_data &);class Sales_data { //友元函数声明,类外部函数read和print可以访问类内数据成员(公有和私有) fri原创 2021-04-27 20:40:15 · 562 阅读 · 0 评论 -
c++primer练习7.31、7.32、7.33、7.34、7.35、7.36、7.37、7.38、7.39、7.40
练习7.31定义一对类X和Y,其中X包含一个指向Y的指针,而Y包含一个类型为X的对象#ifndef ex7_31_H#define ex7_31_Hclass Y;class X{ Y *p = nullptr; //第一次使用Y,上面要声明};class Y{ X a; //定义一个类X的对象a};#endif练习7.32定义Screen和Window_mgr,其中clear是Window_mgr的成员,是Screen的友元#ifndef ex7_32_H#define原创 2021-04-26 22:36:37 · 477 阅读 · 2 评论 -
c++primer练习7.20、7.21、7.22、7.23、7.24、7.26、7.27、7.28、7.29、7.30
练习7.20友元在什么时候有用?分别列举出友元的利弊friend is a mechanism by which a class grants(授予) access(访问) to its nonpublic members.They have the same rights as members.Pros:the useful functions can refer to(引用) class members in the class scope without needing to explici原创 2021-04-26 20:28:47 · 264 阅读 · 0 评论 -
c++primer练习7.11、7.12、7.13、7.14、7.15、7.16、7.17、7.18、7.19
练习7.11在Sales_data类中添加构造函数,然后编写一段程序令其用到每个构造函数#ifndef ex7_11_H#define ex7_11_H#include <string>#include <iostream>struct Sales_data { Sales_data() = default;//因为下面已经有构造函数,但仍然定义默认构造函数,则必须加=default Sales_data(const std::string &原创 2021-04-25 21:26:42 · 334 阅读 · 0 评论 -
c++primer练习7.1、7.2、7.3、7.4、7.5、7.6、7.7、7.8、7.9、7.10
练习7.1使用65页练习定义的Sales_data类为21页的书店交易处理程序编写一个新版本#include <iostream>#include <string>using std::cin;using std::cout;using std::endl;using std::string;using std::cerr;struct Sales_data{ string bookNo; unsigned units_sold = 0;原创 2021-04-25 17:48:46 · 309 阅读 · 1 评论 -
c++primer练习6.49、6.51、6.52、6.53、6.54、6.55、6.56
练习6.49什么是候选函数什么是可行函数?候选函数(Candidate function):重载函数的集合可行函数(Viable function):候选函数中与所调函数最佳匹配的重载函数Candidate function:Set of functions that are considered when resolving a function call.(all the functions with the name used in the call for which a declara原创 2021-04-07 22:20:20 · 335 阅读 · 0 评论 -
c++primer练习6.42、6.43、6.44、6.46、6.47、6.48
练习6.42给make_plural(复数)函数的第二个形参赋予默认实参 ‘s’,利用新版本的函数输出单词success和failure的单数和复数形式#include <iostream>//使用命名空间stdusing namespace std;//形参:字符串长度,字符串内容,要在字符串添加的字符(默认添加s)string make_plural(size_t ctr, const string &word, const string &ending="s")原创 2021-04-07 18:57:45 · 434 阅读 · 0 评论 -
c++primer练习6.32、6.33、6.34、6.35、6.36、6.37、6.38
练习6.36编写一个函数的声明,使其返回数组的引用并且该数组包含10个string对象(不要使用尾置返回类型、decltype或类型别名)string (&func(string(&arrStr)[10]))[10]原创 2021-04-04 21:03:53 · 477 阅读 · 0 评论 -
c++primer练习6.16、6.17、6.18、6.19、6.20、6.21、6.22、6.23、6.24、6.25、6.26、6.27、6.28、6.29
练习6.16下面这个函数虽然合法,但是不算特别有用。指出它的局限性并设法改善bool is_empty(string& s){ return s.empty();}//Since this function doesn't change the argument//"const" should be added before string& s//otherwise this function is misleading and can't be used with const原创 2021-04-03 21:12:37 · 392 阅读 · 2 评论 -
c++练习6.4、6.5、6.7、6.8、6.10、6.11、6.12、6.13、6.14、6.15
练习6.4编写一个与用户交互的函数,要求用户输入一个数字,计算生成该数字的阶乘。在main函数中调用该函数#include <iostream>#include <vector>using std::cin;using std::cout;using std::endl;int fact(int i){ int a=1; while(i>1){ a*=i--; } return a;}int main(){原创 2021-03-31 09:42:14 · 328 阅读 · 0 评论 -
c++primer练习5.5、5.14、5.19
编写一段程序,从标准输入中读取若干string对象并查找连续重复出现的单词原创 2021-03-28 18:59:03 · 150 阅读 · 0 评论 -
c++primer(练习4.10、4.21、4.28、4.29、4.32)
练习4.10为while循环写一个条件,使其从标准输入中读取整数,遇到42时停止#include<iostream>using std::cin;using std::cout;using std::endl;int main(){ int i=0; while(cin>>i && i !=42) cout<<i<<" "; return 0;}Result...原创 2020-12-17 13:38:50 · 365 阅读 · 2 评论 -
c++primer(练习3.41、3.42、3.43、3.44、3.45)
练习3.41编写一段程序,用整形数组初始化一个vector对象要使用数组来初始化vector对象,只需指明拷贝区域的首元素地址和尾后地址即可#include<iostream>#include <vector>using namespace std;int main(){ int a[]={0,1,2}; cout<<"数组的内容:"; for (auto b:a) cout<<b<<" ";原创 2020-12-10 14:00:31 · 299 阅读 · 0 评论 -
c++primer(练习3.31、3.32、3.35、3.36、3.39、3.40)
Practice3.31#include<iostream>#include<vector>#include<string>using namespace std;int main() { int a[10]; for (int i = 0; i <10 ; ++i) { a[i]=i; } for (auto b : a) cout<<b<<" "; r原创 2020-12-07 22:03:10 · 364 阅读 · 0 评论 -
c++(练习3.21、3.22、3.23、3.24、3.25、3.26)
练习3.21使用迭代器输出vector中的具体内容、输出vector的容量如果这里vector< int > v;则it ->empty()出现错误当迭代器指向的元素为整型时,不存在“为空”这个说法,自然不存在empty()这个方法。可以用 v.begin()!=v.end()判定#include<iostream>#include<vector>#include<string>using namespace std;int原创 2020-12-05 20:41:11 · 258 阅读 · 0 评论 -
c++primer(练习3.14、3.15、3.16、3.17、3.19、3.20)
练习3.14编写一段程序,用cin读入一组整数并把它们存入一个vector对象#include <iostream>#include <vector>using namespace std;int main() { int a; vector<int> v; cout << "输入6个整数:" << endl; for (int i = 0; i < 6 ; ++i) { cin原创 2020-12-04 14:37:31 · 344 阅读 · 0 评论 -
c++primer(练习3.6、3.8、3.10、3.11)
练习3.6编写一段程序,使用范围for语句将字符串内的所有字符用X代替预备知识:范围for语句:for (declaration : expression)(循环变量:对象)declaration部分负责定义一个变量,该变量用于访问序列中的基础元素expression部分是一个对象,用于表示一个序列每次迭代,declaration部分的变量会被初始化为expression部分的下一个元素值要想改变对象中的值,必须把循环变量定义成引用类型#include <iostream>原创 2020-11-30 23:00:11 · 262 阅读 · 0 评论 -
c++primer(练习1.14、1.16、2.17、2.38、3.2、3.3、3.5)
练习1.14对比for循环和while循环,两种形式的有缺点各是什么?for循环中,循环控制变量的初始化和修改都放在语句头部,形式简洁且特别适用于循环次数已知的情况while循环中,循环控制变量的初始化,一般放在while语句之前,形式不太简洁,比较适用于循环次数不易预知的情况练习1.16编写程序,从cin读取一组数,输出其和#include <iostream>using namespace std;int main() { int a=0,b=0; cou原创 2020-11-30 21:20:01 · 239 阅读 · 0 评论 -
c++primer(练习1.9、1.10、1.11)
练习1.9编写程序,使用while循环将50到100的整数相加#include <iostream>using namespace std;int main() { int a=0; for (int i = 50; i <=100; ++i) { a+=i; } cout << "从50到100的整数相加的结果:" << a << endl; return 0;}Result练习原创 2020-11-30 15:03:32 · 196 阅读 · 0 评论 -
定时器
电路图要求D1~D8灯间隔1s闪烁完整程序#include<reg51.h>unsigned char t;void main(){ TMOD=0x01;//0000 1111 设置定时器0工作方式1 TH0=(65536-50000)/256;//高8位 0011 1100 TL0=(65536-50000)%256;//低8位 1011 0000 EA=1;//中断总允许 ET0=1;//定时器0的中断开关 TR0=1;//启动定时器0 while(1原创 2020-12-21 15:42:31 · 1523 阅读 · 0 评论 -
Keil和Proteus搭配使用的简单步骤
1.新建项目2.填写文件名称,并保存3.选择芯片4.新建空文档在下图空白处单击鼠标后,按Ctrl+S保存5.将文档命名为:带.c后缀的,并单击保存6.到此步就可以在空白区写出你的优美程序啦!!!7.编译程序前,设置Create Hex File单击下图按钮8.编译(单击下图按钮进行编译)9.编译程序后会在你所建项目文件夹的位置生成与程序对应的带hex后缀文件例如:10.用Proteus打开对应程序的电路图例如:(带DSN后缀的)例如:(带DBK后缀的原创 2020-12-20 13:44:56 · 25201 阅读 · 2 评论 -
单一外部中断的应用
80C51中断系统的组成TCON寄存器(Timer/Counter Control Register)TCON为定时/计数器控制寄存器SCON寄存器(Serial Control Register)SCON为串口寄存器IE寄存器(Interrupt Enable Register)IE为中断允许寄存器IP寄存器(Interrupt Priority Registers)IP为中断优先级寄存器电路图要求无任何操作时D0 ~ D7全亮按下k1后松开时,原创 2020-12-20 17:12:22 · 1941 阅读 · 7 评论 -
数码管显示4×4矩阵键盘的键号
电路图分析P1.0 ~ P1.3控制键盘的列(置0代表按钮被按下)P1.4 ~ P1.7控制键盘的行(置0代表按钮被按下)数码管为共阳极,低电平有效,P0.0 ~ P0.7置0对应数码管中的a,b,c,d,e,f,g,dp段亮完整程序方法一(推荐)#include<reg51.h>#include<intrins.h>//段选segment 0 1 2 3 4 5 6 7 8 9 A原创 2020-12-20 11:57:41 · 16573 阅读 · 20 评论 -
独立式键盘
电路图要求按下k1,led0~led7灯从上到下依次点亮,一直重复此状态按下k2,led0~led7灯从下到上依次点亮,一直重复此状态按下k3,led0~led3灯一起亮,与此同时led4 ~ led7处于熄灭状态,此状态交替出现按下k4,led0~led7同亮同灭闪烁,一直重复此状态条件P3的8个引脚低电平有效,P3.0~P3.7置0则led灯亮按钮被按下时P1的某个引脚接地,该引脚电平为0(引脚置0,则按钮被按下)完整程序#include<reg51.h>#i原创 2020-12-19 20:14:28 · 1570 阅读 · 1 评论 -
八个小数码管滚动显示单个数字
电路图段选:选择每个数码管的某几个二极管(a,b,c,d,e,f,g,dp)位选:选择上图中大数码管中的某一个小数码管大数码管为共阴极,高电平有效(即P0.0~P0.7置1可实现段选)下图所有三极管的集电极接+5V,要使三极管导通,按照下图,需要将q1 ~ q8(分别接引脚P2.0 ~ P2.7置0)下图三极管导通条件:集电极(C)电位 > 基极(B)电位 > 发射极(E)电位因为C接5V,所以q1(接引脚P2.0)为低电平有效,即三极管导通完整程序效果图...原创 2020-12-19 12:09:12 · 4425 阅读 · 6 评论 -
数码管循环显示单个数字
电路图此图中数码管共阳极(低电平有效,不控制小数点dp)数码管内部电路共阴极:a,b,c,d,e,f,g,dp高电平有效共阳极:a,b,c,d,e,f,g,dp低电平有效举例:显示数字0(显示其余数字进行类比)要求先显示偶数(0、2、4、6、8)偶数显示完后,显示奇数(1、3、5、7、9)完整程序#include<reg51.h>//数码管显示数字0~9对应的十六进制unsigned char code led[]={0xC0,0xF9,0xA4,0xB0原创 2020-12-19 00:06:05 · 8330 阅读 · 10 评论 -
开关检测案例2
电路图要求开关s0,s1同时打开,led3亮开关s0,s1同时闭合,led0亮开关s0打开,s1闭合,led1亮开关s0闭合,s1打开,led2亮完整程序#include<reg51.h>sbit led0=P2^0;sbit led1=P2^1;sbit led2=P2^2;sbit led3=P2^3;sbit s0=P1^0;sbit s1=P1^1;void delay(int a)//延时函数{ while(a--);}void main(原创 2020-12-18 23:03:00 · 1880 阅读 · 6 评论 -
开关检测案例1
电路图要求开关S0闭合(打开),LED0亮(灭)开关S1闭合(打开),LED1亮(灭)开关S2闭合(打开),LED2亮(灭)开关S3闭合(打开),LED3亮(灭)完整程序#include<reg51.h>sbit led0=P1^0;sbit led1=P1^1;sbit led2=P1^2;sbit led3=P1^3;sbit s0=P1^4;sbit s1=P1^5;sbit s2=P1^6;sbit s3=P1^7;void main(){原创 2020-12-18 22:32:01 · 2297 阅读 · 4 评论 -
流水灯上下循环流动
电路图#include<reg51.h>#include<intrins.h>void delay(int a){ while(a--);}void crol() //自定义左移函数{ delay(30000); P1=_crol_(P1,1);} void cror() //自定义右移函数{ delay(30000); P1=_cror_(P1,1);}void main(){ unsigned char i; P1=0x原创 2020-12-18 15:53:38 · 3786 阅读 · 17 评论 -
流水灯
电路图#include<reg51.h>#include<intrins.h>//内含左移_crol_函数,右移_cror_函数void delay(int a)//延时函数{ while(a--);}void main(){ P1=0xfe;//1111 1110 while(1) { delay(30000); P1=_crol_(P1,1);//左移函数 /1111 1101 /1111 1011 /1111 0111 }原创 2020-12-18 14:09:49 · 565 阅读 · 0 评论