摘要: 先看一段代码: #include <iostream>#include<string>using namespace std; class Student{ public: Student(int,string,float); void display(); protected: int num; 阅读全文
posted @ 2021-06-04 16:51 焓青 阅读(185) 评论(0) 推荐(0)
摘要: 转载:(28条消息) C / C++ 保留两位小数(setprecision(n)的一些用法总结)_LolitaSian-CSDN博客 阅读全文
posted @ 2021-05-31 22:19 焓青 阅读(260) 评论(0) 推荐(0)
摘要: 转载:(28条消息) C++中万能头文件bits/stdc++.h的介绍_QAQ的博客-CSDN博客_bits/stdc++.h 很多小伙伴估计看有的代码会碰见没有多余的其它头文件比如algorithm、cmath、iostream而是用了一行#include<bits/stdc++.h>这样的头文 阅读全文
posted @ 2021-05-31 22:15 焓青 阅读(2481) 评论(0) 推荐(0)
摘要: 摘自洛谷题解:大佬的:#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, 阅读全文
posted @ 2021-05-21 17:16 焓青 阅读(368) 评论(0) 推荐(0)
摘要: 利用递归求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)//主函 阅读全文
posted @ 2021-05-12 15:41 焓青 阅读(43) 评论(0) 推荐(0)
摘要: 摘自:哔哩哔哩黑马程序员 常见的函数样式有4种 1、无参无返 2、有参无返 3、无参有返 4、有参有返 例子: #include<iostream>using namespace std;//无参无返void test01(){ cout<<"this is a test"<<endl;}//有参无 阅读全文
posted @ 2021-05-08 20:36 焓青 阅读(64) 评论(0) 推荐(0)
摘要: 摘自:黑马程序员 所谓值传递,就是函数调用时实参将数值传入给形参 值传递时,如果形参发生改变,并不影响实参 示例: #include<iostream>using namespace std; void swap(int num1,int num2){ cout<<"交换前:"<<endl; cou 阅读全文
posted @ 2021-05-08 20:16 焓青 阅读(69) 评论(0) 推荐(0)
摘要: 摘自:哔哩哔哩黑马程序员 6.1概述 作用:讲一段经常用的代码封装起来,减少重复代码,一个较大的程序,一般分为若干个程序块,每个模块实现特定的功能。 函数的定义一般有五个步骤: 1、返回值类型 2、函数名 3、参数列表 4、函数体语句 5、return 表达式 语法:返回值类型 函数名 (参数列表) 阅读全文
posted @ 2021-05-08 19:41 焓青 阅读(218) 评论(0) 推荐(0)
摘要: 摘自:C++中cin、cin.get()、cin.getline()、getline()、gets()等函数的用法 - flatfoosie - 博客园 (cnblogs.com) 阅读全文
posted @ 2021-04-27 22:42 焓青 阅读(49) 评论(0) 推荐(0)
摘要: C,C++规定,16进制数必须以 0x开头。比如 0x1表示一个16进制数。而1则表示一个十进制。另外如:0xff,0xFF,0X102A,等等。 其中的x也不区分大小写。(注意:0x中的0是数字0,而不是字母O) 以下是一些用法示例: int a = 0x100F; int b = 0x70 + 阅读全文
posted @ 2021-04-24 15:55 焓青 阅读(1485) 评论(0) 推荐(0)