自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 文件流

C++的IO流:文件打开方式: 模式标志 描述 ios::in 读方式打开文件 ios:out 写方式打开文件 ios::trunc 如果此文件已经存在, 就会打开文件之前把文件长度截断为0 ios::app 尾部最加方式(在尾部写入) ios::ate ...

2021-06-03 20:51:01 88

原创 二级指针

二级指针也是一个普通的指针变量,只是它里面保存的值是另外一个一级指针的地址#include <iostream>#include <Windows.h>#include <string>using namespace std;int main(){ int cabinet1 = 12; //柜子1里存放12; int *cabinet2 = &cabinet1; //柜子2里保存柜子1的地址 int **lq = &cabinet

2021-04-07 19:55:26 110

原创 杨辉三角

#include <iostream>#include <Windows.h>#include <string>#include<iomanip>using namespace std;#define N 10int main(){ int a[N][N] = { 0 }; //二维数组所有元素为0 for (int i = 0; i < N; i++) { for (int j = 0; j <= i; j++) .

2021-04-05 13:31:39 84

原创 从txt文件中读取数据到二维数组中并输出峰值所在的行和列

先在此路径下创建txt文件,如图所示:txt文件第一行为行和列,读取六行七列的元素到二维数组,判断九宫格内是峰值的元素并打印它的行和列#include <iostream>#include <Windows.h>#include <string>#include<fstream>using namespace std;#define N 128bool MaxSite(int a[N][N], int m, int n)..

2021-04-05 12:03:23 294

原创 c++课本第三章课后习题

1.#include<iostream>#include<Windows.h>using namespace std;class Box{public: Box() { length = 0; width = 0; height = 0; } void clength() { float i; cout << "请输入长方体的长度" << endl; cin >> i; length = i; c.

2021-03-31 22:53:48 349

原创 代码界的TP:goto语句

#include<iostream>#include<Windows.h>#include<string>using namespace std;int main(){ string xq; for (int i = 0; i < 3; i++) { cout << "同意第" << i + 1 << "个好友位" << endl; cout << "你喜欢玩打野?" <&l.

2021-03-30 18:33:50 131

原创 用EasyX加载一个圆形和背景图

#include<graphics.h>#include<windows.h> int main(){ initgraph(640, 480); loadimage(0,"pp.jpg"); //加载背景照片 setbkcolor(RGB(255, 0, 0)); cleardevice; //清除屏幕内容 setlinecolor(RGB(255, 0, 0)); //设置画笔的颜色 setlinestyle(PS_SOLID, 10); //设置画笔的样式(.

2021-03-21 21:01:07 1208

原创 计算输入单词的个数与长度

连续输入多个单词,然后统计这些单词的长度,以及单词个数#include<iostream>#include<windows.h>#include<string>using namespace std;int main(){ string word; int count = 0; int length = 0; cout << "请输入任意多个单词:" << endl; while (1) { if ((bool)(c

2021-03-19 22:06:34 698

原创 String字符串的比较

String字符串的比较:比较规则:与C语言相同.从第一个字符串开始 ,对应字符逐个比较,直到遇到不想等的字符为止比较运算符:> >= < <= ==比较运算的结果:逻辑真,逻辑假"123" < "1230" 真"19" < "123456789" 真"123" < "1999" 真...

2021-03-18 22:04:37 767

原创 String字符串的输入输出

String字符串输入经常会遇到下面的情况:#include<iostream>#include<windows.h>#include<string>using namespace std;int main(){ string food; cout << "你喜欢吃什么?" << endl; cin >> food; cout << "你最喜欢吃的美食有" << food <<

2021-03-18 20:37:16 2865

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除