
笔记
文章平均质量分 94
KonoHT
这个作者很懒,什么都没留下…
展开
-
【vscode调试配置、输出中文乱码解决】关于VSCode的C++原生断点调试debug和运行的配置和中文乱码的问题(非code runnner)
下面是本文章所解决的四个问题:问题一:如何配置原生断点调试和运行?问题二:如何更改调试和运行环境为vscode内的终端还是系统的cmd终端?问题三:在vscode内置终端中,如何选择Powershell终端还是cmd终端?问题四:如何解决输出中文字符乱码的情况?问题一:如何配置原生断点调试和运行?这个问题指的是在vdscode中可以打断点调试的功能(快捷键是F5),即下图处的功能:我的建议是:直接在你的工作区的目录新建一个.vscode文件夹;在.vscode文件夹中新建task原创 2021-02-18 15:53:03 · 27963 阅读 · 13 评论 -
【PAT甲级、C++、大整数运算】1023 Have Fun with Numbers (20分)
# include <iostream># include <unordered_map>using namespace std;struct bign{ int d[100]; int len; bign(): d{0}, len(0){} bign(string str): bign(){ // 记得写 : bign() len = str.size(); for(size_t i=0;i&l原创 2020-12-08 19:10:53 · 170 阅读 · 1 评论 -
【PAT甲级、C++、散列表之二次探测法】1078 Hashing (25分)
晴神宝典上的写法# include <iostream># include <cmath># include <vector># include <algorithm># include <climits>using namespace std;bool isPrime(int n){ if(n == 1) return false; int sq = (int)sqrt(n);原创 2020-12-08 11:07:40 · 306 阅读 · 0 评论 -
【PAT乙级、分数的运算、C++类练习】1034 有理数四则运算 (20分)
# include <iostream># include <cmath># include <climits>using namespace std;typedef long long ll;ll gcd(ll a, ll b){ return b==0 ? a : gcd(b, a % b);}struct Fraction{ ll up; ll down; Fraction() = default;原创 2020-12-07 19:17:44 · 163 阅读 · 0 评论 -
C++返回局部对象并使用时,并没有调用赋值运算符函数或拷贝构造函数
可以看出只要是返回局部对象(返回匿名对象也一样),如果将它赋值给对象,或者是将它作为拷贝构造函数的参数,都不会调用你以为的那个函数。…………至于为什么改日再究。# include <iostream>using namespace std;struct Data{ int a; Data(){ cout << "无参构造函数\n"; } Data(int b){ this->a = b;原创 2020-12-07 17:19:01 · 526 阅读 · 0 评论 -
【DFS、邻接矩阵、栈写法、非递归】深度优先搜索的两种非递归的栈写法
两种写法的区别就是for循环的处理方式的区别,仔细观察分析第一种写法void AMG_DFS_stack(AMGraph * g, void (*visit)(VertexType), int v0){ bool * visited = new bool[g->vexnum]; memset(visited, false, sizeof(bool)); stack<INDEX> s; visit(g->vexs[v0]); vi原创 2020-11-20 22:06:28 · 326 阅读 · 0 评论 -
【Leetcode 147】对链表进行插入排序
对链表进行直接插入排序1、head指向链表的第一个元素(这就是题解)/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* insertionSortList(List原创 2020-11-20 12:26:13 · 164 阅读 · 0 评论 -
【C++版本】大整数bign的建立与运算
# include <iostream># include <string>using namespace std;struct bign{ int d[1000]; int len; bign() : d{0}, len(0){} // // memset(d, 0, sizeof(d)); bign(string num): bign(){ this->len = num.size(); //原创 2020-12-04 15:38:05 · 600 阅读 · 0 评论 -
【C++、折半插入排序】纯用vector的函数进行插入排序(要求给出每一趟插入排序的结果应该可以用这个)
这样写感觉会出现问题,但是目前看来是可以进行插入排序的(如果题目要求给出每一趟插入排序的结果应该可以用这个)void insert_sort(vector<int> &A){ for(vector<int>::iterator it = A.begin() + 1;it != A.end();it++){ if(*it < *(it-1)){ int x = *it; vector<int原创 2020-11-29 11:39:08 · 258 阅读 · 0 评论