ICode9

精准搜索请尝试: 精确搜索
  • c++11 为什么使用ref,和引用的区别2022-09-16 18:33:54

    std::ref只是尝试模拟引用传递,并不能真正变成引用,在非模板情况下,std::ref根本没法实现引用传递,只有模板自动推导类型时,ref能用包装类型reference_wrapper来代替原本会被识别的值类型,而reference_wrapper能隐式转换为被引用的值的引用类型。 std::ref主要是考虑函数式编程(如std::bi

  • 8.1 优化cout查询2022-09-14 13:30:31

    优化COUNT()查询 COUNT()聚合函数,以及如何优化使用了该函数的查询,很可能是MySQL中最容易被误解的话题之一。在网上随便搜索一下就能看到很多错误的理解,可能比我们 想象的多得多。在做优化之前,先来看看COUNT()函数真正的作用是什么。 COUNT()的作用 COUNT()是一个特殊的函数,有两种

  • c++静态for循环2022-09-14 10:03:56

    #include <iostream> // 通过递归实现 template <int Beg, int End> struct static_for { template <typename Fn> void operator()(const Fn& fn) const { if (Beg < End) { fn(Beg); static_for&l

  • 252022-09-13 23:04:26

    1 #include <iostream> 2 using namespace std; 3 class A { 4 private: 5 int nVal; 6 public: 7 void Fun() 8 { cout << "A::Fun" << endl; }; 9 virtual void Do() 10 { cout << "A::Do&quo

  • 024:这是什么鬼delete2022-09-13 23:03:55

    1 #include <iostream> 2 using namespace std; 3 class A 4 { 5 public: 6 A() { } 7 virtual ~A() { cout << "destructor A" << endl; } 8 }; 9 class B:public A { 10 public: 11 ~B() { cout << "de

  • 272022-09-13 23:03:22

    1 #include <iostream> 2 #include <string> 3 using namespace std; 4 template <class T> 5 T SumArray( 6 T *p,T *q){ 7 T sum = *p; 8 while(++ p != q) 9 sum += *p; 10 return sum; 11 } 12 int main() { 13 string array[4]

  • 001:简单的swap2022-09-13 22:33:48

    1 #include <iostream> 2 using namespace std; 3 class A 4 { 5 public: 6 int x; 7 int getX() { return x; } 8 }; 9 void swap( 10 A& a,A& b 11 ) 12 { 13 int tmp = a.x; 14 a.x = b.x; 15 b.x = tmp; 16 } 17 int

  • 002:难一点的swap2022-09-13 22:32:58

    1 #include <iostream> 2 using namespace std; 3 4 void swap( 5 int* &a,int* &b 6 ) 7 { 8 int * tmp = a; 9 a = b; 10 b = tmp; 11 } 12 int main() 13 { 14 int a = 3,b = 5; 15 int * pa = & a; 16 int * pb = &

  • 年月日闰年平年判断2022-09-12 12:30:34

    #include <iostream>using namespace std;class date{    int Year, Month, Day;public:    void SetYear(int year);    void SetMonth(int month);    void SetDay(int day);    int isLeap(int year);//布尔判断闰年    int Check(int year, int month, int

  • 11.拷贝构造函数2022-09-12 11:02:06

    #include <iostream> using namespace std; class Maker { private: int a; public: Maker() { cout << "无参构造函数" << endl; a = 20; } //拷贝构造函数 Maker(const Maker &m) { cout <<

  • 13.匿名对象2022-09-12 11:00:08

    //2022年9月9日09:54:59 #include <iostream> using namespace std; class Maker { public: Maker() { cout << "无参构造函数" << endl; } Maker(int a) { cout << "有参构造函数" << endl; }

  • 桶排序C语言代码2022-09-11 23:03:30

    #include <iostream> #include <cstdio> using namespace std; int a[1001], num, n, cnt=0; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> num; a[num]++; if (a[num]

  • C++ 第9课字符三角形2022-09-11 22:02:54

    #include <iostream> #include <string> using namespace std; int main(int argc, char** argv) { char a; cout<<"请输入一个字符:"; cin>>a; cout<<" "<<a<<endl; cout<<" "<<a<&

  • C++ 第40课转进制2022-09-11 21:30:22

    #include <iostream> #include <string> using namespace std; int main() { /*string a; int p = 1; int s = 0; cout<<"请输入一个二进制数:"; cin>>a; for(int i = a.length()-1;i>=0;i--){ int x = a[i]-�

  • MC钻石铲代码2022-09-11 18:32:14

    #include <iostream> #include <string> #include <Windows.h> #include "minecraft.h" using namespace std; TxMinecraft tongxin; int main(int argc, char** argv) { cout<<"准备开始"<<endl; string Server="tk.ma

  • C++学习笔记-day132022-09-11 13:33:50

    1、多态的基本概念   #include<iostream> using namespace std; //多态 class Animal { public: //虚函数 virtual void speak() { cout << "动物在说话" << endl; } }; //猫类 class Cat :public Animal { public: void speak()

  • C++STL笔记2022-09-10 11:03:45

    STL学习笔记 参考文档: https://cplusplus.com/reference/ https://zh.cppreference.com/w/首页 https://docs.microsoft.com/en-us/cpp/standard-library/cpp-standard-library-reference?view=msvc-170 https://github.com/huihut/interview 总体总结 容器分类 容器复合

  • 交互题2022-09-06 20:02:19

    1、Dragon Balls 暴力求解,把每次可能的值都求出来,然后逐个比较。 #include<bits/stdc++.h> #define int long long int using namespace std; int x, n; typedef pair<int, int> pii; vector<pii> vet; signed main(){ cin >> n; while(n -- ){ cout <

  • C++面向对象-构造函数与析构函数2022-09-06 08:00:44

    以OOP实现一个顺序栈为例, 介绍构造函数与析构函数 #include <iostream> #include <iterator> using namespace std; /* 构造函数和析构函数 函数的名字和类名一样,没有返回值 */ class SeqStack { public: //构造函数有参数,可重载 SeqStack(int size = 10) {

  • 【链表、队列】约瑟夫环问题2022-09-05 17:31:06

    3253. 游戏 #include <iostream> #include <queue> using namespace std; int n, k; bool check(int x) { if (x % k == 0 || (x % 10) == k) return true; return false; } int main() { cin >> n >> k; queue<int> q;

  • Codeforces Round #816 (Div. 2)2022-09-05 01:02:15

    \(\quad\) 今早头一次睡到了九点,大概昨天在健身房确实训练过度了,胸廓酸软,大腿一直颤抖。 \(\qquad\) 下午去了趟实验室,完成了我的第一个物联网程序虽然很水。慢慢试着用\(VS\quad CODE\)切题,效率一般,命令行与编译指令反而不知不觉间搞懂了……还是很垃圾,一整天只做出五道题,其中两

  • 【补】2022.7.24———HZOI【来自学长的馈赠4】2022-09-04 19:32:40

    成绩综述 $ Rank 32/51 $ 本场比赛随机化现象显著... 不过随机化真的好用 题 \(\mathfrak{T1}\ 活动投票\) 本来是个水题 然后看到了奇怪的东西 \(\color{red}{时限:0.5s\ 内存:2M}\) \(?(缓缓打出一个问号)\) 先不说正解说说部分分,考场上我是怎么想的呢,既然我不能把数组全开完,那

  • C++随笔cout.precision(n)的作用2022-09-04 15:04:06

    是C++输出函数cout的一个格式控制函数,用以控制输出数据的精度(保留小数点后几位) ... cout.precision(n); ... 用于控制小数输出位数,例如 a = 1.2345; cout.precision(2); cout<<a<<endl; //输出1.23

  • asio使用例子2022-09-03 21:00:42

    阻塞调用 # include<iostream> # include<boost/asio.hpp> # include<boost/date_time/posix_time/posix_time.hpp> using namespace std; int main() { cout << "One" << endl; boost::asio::io_service io; boos

  • map_set使用说明2022-09-03 17:01:20

    map_set使用说明 map的底层结构大致是一个哈希表,set的底层结构大致是一个红黑树 不代表全部!   set #include"map_set.h" //set的底层结构大致是一个红黑树 不代表全部! void test1() { //set的结构天生有排序+去重 set<int> s; s.insert(2); s.insert(2);

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有