C++
文章平均质量分 52
Stupid小池
果壳研究僧/健身小白/前端开发学徒/ladygaga狂热粉
坚持写博客记录自己的学习,“Whether people show up or they don’t, you’re out
there, doing your thing, ready whenever they are.”
展开
-
第一次使用CLion的配置
废话:最近在准备考研复习到数据结构,想着把书上的代码敲一下印象可能会更深一点。选了CLion作为IDE,怎么配置全忘光了,其实挺简单,因为自己不懂走了不少弯路,整理于此。首先新建一个project,你会发现是没法运行的,因为没有配置环境1. 配置toolchains按照官方给的这份guide,下载MinGW然后安装好,目录一定不能有中文然后找到 File | Settings | Build, Execution, Deployment | Toolchains.然后后面的编译器什么的自己就原创 2021-06-27 16:39:11 · 1609 阅读 · 0 评论 -
linux使用管道pipe系统调用在兄弟进程之间读写
题目:编写一个程序,创建两个子进程,并使用pipe0系统调用,将一个子进程的标准输出连接到另一个子进程的标准输入。(OS: three esay pieces page36)理论参考:https://www.cnblogs.com/zhangxuan/p/6704915.html代码:#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#inc原创 2020-10-23 09:06:12 · 1112 阅读 · 1 评论 -
C的基本函数库+gcc在线文档【指令含义】
Cgcc原创 2020-10-15 11:29:08 · 131 阅读 · 0 评论 -
蓝桥:day 9.2-9.3
2.tips:gets()得到输入字符数组strlen检测字符数组中字符的长度原创 2019-09-09 17:24:34 · 100 阅读 · 0 评论 -
《C++程序设计》Chapter9:对象和类
文章目录9.1 introduction9.2 Defining Classes for Objects9.3 例子:定义类创建对象9.4 Constructors9.5 构建和使用对象9.6 分离类的定义与执行9.1 introduction面向对象编程的开始9.2 Defining Classes for Objects对象代表了实体,包括行为和属性(data field 数据项);...原创 2019-07-05 17:46:19 · 155 阅读 · 0 评论 -
c++输入问题:输入回车判断当前输入结束
//// main.cpp// 7.20//// Created by ZhangChi on 2019/6/17.// Copyright © 2019 ZhangChi. All rights reserved.//#include <iostream>using namespace std;int main() { int mk[...原创 2019-06-17 20:20:08 · 2280 阅读 · 0 评论 -
C++:八皇后问题
//// main.cpp// 6.37//// Created by ZhangChi on 2019/5/31.// Copyright © 2019 ZhangChi. All rights reserved.//#include<iostream>using namespace std;const int N = 8; //N值代表几皇后问题...转载 2019-06-17 19:44:04 · 746 阅读 · 0 评论 -
《C++程序设计》chapter 8:多维数组
文章目录8.1 introduction NULL8.2 声明二维数组 NULL8.3 操作二维数组8.4 传递二维数组给函数 NULL8.5 问题:给选择题打分 NULL8.6 问题:找到最近的一对点8.7 问题:数独8.8 多维数组8.8.1 问题:日常温度湿度(三维数组的应用)8.8.2 问题:猜生日8.1 introduction NULL8.2 声明二维数组 NULL8.3 操作二...原创 2019-06-11 20:19:48 · 110 阅读 · 0 评论 -
《C++程序设计》 Chapter 7:一维数组
文章目录7.1 introduction NULL7.2 数组基本要素 NULL7.3 问题:乐透数 NULL7.4 问题:扑克牌7.5 给函数传数组7.6 防止数组参数变化7.1 introduction NULL7.2 数组基本要素 NULL7.3 问题:乐透数 NULL7.4 问题:扑克牌problem: Creat a program that will randomly...原创 2019-06-04 21:37:47 · 182 阅读 · 0 评论 -
C++中的单引号和双引号区别
原创 2019-06-04 20:02:42 · 1257 阅读 · 0 评论 -
Print distinct numbers
enter ten number: 1 2 3 2 1 6 3 4 5 2the distinct number are:1 2 3 6 4 5code:#include <iostream>#include <iomanip>using namespace std;int main(){ cout<<"enter ten numb...原创 2019-06-09 17:42:01 · 473 阅读 · 0 评论 -
string类型二进制转化为string类型十进制:再谈int和string互化
preface之前有一篇转载的文章提到了int和string的互化,但在今天解决问题的时候仍然感觉不足,在此补充。原问题:string类型二进制转化为string类型十进制遇到的问题及解决对函数return的理解。在main中直接使用函数(例如输出),相当于直接使用函数内返回的变量。✅ int ——> string 类型:解决参考博客,其中的详细解释://⚠️头文件:#in...原创 2019-06-02 19:41:51 · 1635 阅读 · 0 评论 -
C++:char转换为int(char to int )
文章目录1.通过ascii码:2.直接转换(更简单,推荐)1.通过ascii码:char a = '0';int ia = (int)a; /* note that the int cast is not necessary -- int ia = a would suffice */cout<<ia<<endl;结果如下:可以看出这种方法得到的其实是ch...转载 2019-05-31 21:59:52 · 45852 阅读 · 2 评论 -
C++如何控制每行输出的个数?
consolecodeint main(){ int j=-1; //注意这里!1️⃣j在for的后面 2️⃣j初始化为-1 for(int i=0;i<50;i++){ j=j+1; if(j==10){ cout<<endl; j=0; } ...原创 2019-05-13 11:24:57 · 18507 阅读 · 0 评论 -
5.13C++工作台 未完成
#include <iostream>#include <sstream>#include <string>using namespace std;int mian(){ string text("LadyGaga is QUEEN"); stringstream gaga(text); string word;...原创 2019-05-13 11:01:29 · 171 阅读 · 0 评论 -
C++生成日历
效果代码#include <iostream>#include <iomanip>using namespace std;bool isLeapYear(int year);int getTotalNumberOfDays(int year,int month);int getNumberOfDaysInMonth(int year,int month)...原创 2019-05-13 10:14:23 · 1431 阅读 · 0 评论 -
《C++程序设计》 Chapter 6:函数
文章目录6.1 Introduction NULL6.2 定义一个函数6.3 函数调用6.4 void 函数6.56.1 Introduction NULL6.2 定义一个函数6.3 函数调用6.4 void 函数6.5原创 2019-05-13 10:00:26 · 119 阅读 · 0 评论 -
《C++程序设计》 Chapter 4:数学函数、字符和字符串
文章目录4.1:introdution4.2:数学函数4.3:字符数据类型及操控4.4:生成随机字符4.5:例子--猜生日4.6:字符函数4.7:例子--16进制转化为10进制4.8:String字符串类型4.1:introdution4.2:数学函数包括: 三角函数、指数函数、凑整函数header:#include <cmath>例子:计算三角函数并用角度和弧度形式输出...原创 2019-04-29 08:37:43 · 125 阅读 · 0 评论 -
《C++程序设计》 Chapter 5:循环 (
文章目录5.1 inrodution NULL5.2 while 循环5.3 do-while 循环 NULL5.4 for 循环 NULL5.5 用哪一个循环 NULL5.6 嵌套循环 NULL5.7 减少数字错误5.8 例子学习5.8.1 找到最大公约数 NULL5.8.2 预算未来学费 NULL5.8.3 蒙特卡洛仿真5.8.4 十进制转化为十六进制5.9 关键字 break和contin...原创 2019-05-03 10:49:29 · 142 阅读 · 0 评论