随笔分类 -  C++

摘要:#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <list>#include <map>using namespace st 阅读全文
posted @ 2018-01-02 13:50 阿蓉 阅读(227) 评论(0) 推荐(0)
摘要:#include<iostream>#include<string>#include<fstream>#include<sstream>using namespace std;#define _CRT_SECURE_NO_WARNINGSclass Tair //通过定义一个类来定义数据录入的函数 阅读全文
posted @ 2017-12-18 11:23 阿蓉 阅读(144) 评论(0) 推荐(0)
摘要:#include <iostream>using namespace std;//数组的前一个元素和后一个元素相比void select_sort(int *p,int n){ int i, j, k, t; for (i = 0; i < n - 1;i++) { k = i; for (j = 阅读全文
posted @ 2017-11-05 22:36 阿蓉 阅读(136) 评论(0) 推荐(0)
摘要:#include <iostream>using namespace std;int main(){ int a[11]; int i, j, t; cout << "input 10 numbers: " << endl; for (i = 1; i <= 10;i++) { cin >> a[i 阅读全文
posted @ 2017-11-05 21:43 阿蓉 阅读(136) 评论(0) 推荐(0)
摘要:// 堆栈.cpp : 定义控制台应用程序的入口点。//一种数据结构//堆栈中的元素遵循后进先出的原则(LIFO)后入栈的元素先出栈//队列//队列中的元素遵循先进先出的原则,先进队列的元素先出队列 //stack 堆栈 适配器容器 是由其他容器实现的(可以指定由其它容器实现)/*push()压入堆 阅读全文
posted @ 2017-11-04 12:08 阿蓉 阅读(131) 评论(0) 推荐(0)
摘要:// list.cpp : 定义控制台应用程序的入口点。// #include "stdafx.h"#include <list>#include <iostream>using namespace std;//using std::list; int _tmain(int argc, _TCHAR 阅读全文
posted @ 2017-10-27 12:11 阿蓉 阅读(161) 评论(0) 推荐(0)
摘要:#include <iostream>#include <vector>using namespace std;int main(){ /* vector线性容器 类似于数组 */ vector<int> vecInt; //不带参数 vecInt.push_back(1);//往后面加一个 vec 阅读全文
posted @ 2017-10-27 12:10 阿蓉 阅读(191) 评论(0) 推荐(0)
摘要:// deque.cpp : 定义控制台应用程序的入口点。// deque容器//称双端队列//支持随机访问,同时能和list一样在头部和尾部插入和删除数据/* deque()声明一个空deque deque(n)声明一个0到n-1个元素的deque deque(n,val)声明一个n个值为val的 阅读全文
posted @ 2017-10-27 12:09 阿蓉 阅读(227) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include<string>#include<list>#include<iostream>using namespace std;int _tmain(int argc, _TCHAR* argv[]){ string str("abc"); str[0] 阅读全文
posted @ 2017-10-25 10:41 阿蓉 阅读(139) 评论(0) 推荐(0)
摘要:/*#include <iostream>#include <vector>using namespace std;int main(){ vector<int> vecInt; vecInt. push_back(1); vecInt. push_back(2); vecInt.push_back 阅读全文
posted @ 2017-09-24 10:53 阿蓉 阅读(222) 评论(0) 推荐(0)
摘要:#include <iostream>using namespace std;struct stnode //stnode为结构体名字{ //数据部分 int value; //指针部分 stnode* pNext;//结构体类型的指针}; stnode* g_phead = NULL; //链表头 阅读全文
posted @ 2017-09-08 20:23 阿蓉 阅读(184) 评论(0) 推荐(0)