
c++
就是用c++写的东西啦
Cwiyc
流水不争先,争的是滔滔不绝。
展开
-
202109-1 数组推导 CCF模拟题
using namespace std;int main(){ int a[105], b[105], ma[105], mi[105];//最大数组,最小数组 int n; cin >> n; int max = 0; int sum1 = 0, sum2 = 0; for (int i = 1; i <= n; i++) { cin >> b[i]; ma[i] = b[i];..原创 2021-11-22 11:09:24 · 193 阅读 · 0 评论 -
直接插入排序(c++ 可直接运行)
直接插入排序 可运行代码帮大家解决燃眉之急 懂得都懂 哈哈#include <iostream>using namespace std;void InsertSort(int r[], int n){ int j = 0; for (int i = 2; i <= n; i++) { r[0] = r[i]; j = i - 1; while (r[0] < r[j]) {原创 2021-07-02 17:10:17 · 169 阅读 · 0 评论 -
希尔排序(c++ 可直接运行)
希尔排序 可运行代码#include <iostream>using namespace std;void XierSort(int r[], int n){ for (int d = n / 2; d >= 1; d /= 2) { int j = 0; for (int i = d + 1; i <= n; i++) { r[0] = r[i]; j = i原创 2021-07-02 17:04:23 · 181 阅读 · 0 评论 -
C++堆排序代码(可运行)
堆排序可直接运行代码下面的代码可直接运行#include <iostream>using namespace std;void sift(int r[], int k, int end){ int i, j; i = k; j = 2 * i; while (j <= end) { if (j < end && r[j] < r[j + 1]) { j++;原创 2021-06-30 09:42:00 · 377 阅读 · 0 评论 -
KMP算法代码(可运行)
KMP算法下面的代码是可以运行的,拿回去研究研究吧#include <iostream>#include <string>using namespace std;#define Max 30void GetNext(string T, int next[], int length){ next[0] = -1; int k = -1, j = 0; while (j <= length) { if (k == -1原创 2021-06-30 09:36:56 · 373 阅读 · 0 评论 -
c++结构体实现链队列
c++结构体实现链队列可以先copy下来测试一下,慢慢学可以先copy下来测试一下,慢慢学#include <iostream>using namespace std;struct Node //定义队列的节点{ Node *next; double data;};struct Queue //定义队列的数据结构{ Node *front; Node *rear;};void Initqueue(Queue &queue) //初始化一原创 2021-03-17 23:49:37 · 457 阅读 · 0 评论 -
c++用类实现链队列/顺序表
c++用类实现链队列/顺序表本篇文章实现相对较简单,但也是类实现,方法大致与结构体相似本篇文章实现相对较简单,但也是类实现,方法大致与结构体相似#include <iostream>using namespace std;#define max_size 10class Node//节点{public: Node *next; int data;};class List{public: List(int &n); ~List();原创 2021-03-17 23:44:00 · 337 阅读 · 0 评论 -
c++二进制读写文件
c++二进制读写文件#include<iostream>#include<fstream>using namespace std;class Person{public: char m_Name[64]; int m_Age;};void text01(){ //1.包含头文件 //2.创建流对象 ofstream ofs("person.txt",ios::out|ios::binary); //3.打开文件原创 2021-03-16 17:31:49 · 343 阅读 · 4 评论 -
c++写文件操作
c++写文件操作#include<iostream>#include<fstream>//操作文件的头文件#include<string>using namespace std;void ofstr(){ ofstream ofs; //定义流对象 ofs.open("text.txt",ios::out); //以写的方式打开文件 ofs<<"woshichuhh"<<endl;//写入 o原创 2021-03-16 17:29:21 · 10715 阅读 · 7 评论