05 2021 档案
摘要:转载:(28条消息) C / C++ 保留两位小数(setprecision(n)的一些用法总结)_LolitaSian-CSDN博客
阅读全文
摘要:转载:(28条消息) C++中万能头文件bits/stdc++.h的介绍_QAQ的博客-CSDN博客_bits/stdc++.h 很多小伙伴估计看有的代码会碰见没有多余的其它头文件比如algorithm、cmath、iostream而是用了一行#include<bits/stdc++.h>这样的头文
阅读全文
摘要:摘自洛谷题解:大佬的:#include <bits/stdc++.h> using namespace std; int mp[100][100]; int last[100]; int n = 22, m = 62; // 在[x1-x2, y1-y2]绘制ch void draw(int x1,
阅读全文
摘要:利用递归求1+2+3+4+……+N #include<iostream> using namespace std; int sum(int n){ if(n == 0) { return 0; } return sum(n - 1)+n;//注意返回式子的书写} int main(void)//主函
阅读全文
摘要:摘自:哔哩哔哩黑马程序员 常见的函数样式有4种 1、无参无返 2、有参无返 3、无参有返 4、有参有返 例子: #include<iostream>using namespace std;//无参无返void test01(){ cout<<"this is a test"<<endl;}//有参无
阅读全文
摘要:摘自:黑马程序员 所谓值传递,就是函数调用时实参将数值传入给形参 值传递时,如果形参发生改变,并不影响实参 示例: #include<iostream>using namespace std; void swap(int num1,int num2){ cout<<"交换前:"<<endl; cou
阅读全文
摘要:摘自:哔哩哔哩黑马程序员 6.1概述 作用:讲一段经常用的代码封装起来,减少重复代码,一个较大的程序,一般分为若干个程序块,每个模块实现特定的功能。 函数的定义一般有五个步骤: 1、返回值类型 2、函数名 3、参数列表 4、函数体语句 5、return 表达式 语法:返回值类型 函数名 (参数列表)
阅读全文