随笔分类 -  C/C++

上一页 1 2 3 4 5 6

c++ 11
摘要:1.forward_list单向链表 成员函数 构造函数 析构函数 =操作运算符 迭代器 容量 元素的获取 修饰符 操作 观察者 全局函数 函数remove_if()移除序列[start, end)中所有应用于谓词p返回true的元素. 此函数返回一个指向被修剪的序列的最后一个元素迭代器. 记住, 阅读全文

posted @ 2016-09-14 16:53 邗影 阅读(196) 评论(0) 推荐(0)

codeblocks不支持c++11的有效解决办法
摘要:首先cb支持c++11编程开发,但是不支持编译 看了网上好多,说setting里面设置一下就好了,16.01版本我安装了带ide的不带IDE的,安了好多次,但是就是没有那个选项 找不到c++11那个选项。。。沃日 同样官网下的,为啥我的就没有那个选项,,哭死 后来,在某群安了个 安完了打开真的,,, 阅读全文

posted @ 2016-09-13 19:11 邗影 阅读(4057) 评论(0) 推荐(0)

manacher最长回文序列c++
摘要:#include <iostream> #include<string> #include<cstring> using namespace std; char * pre(char *str) { int length = strlen(str); char *prestr = new char[ 阅读全文

posted @ 2016-09-12 21:24 邗影 阅读(316) 评论(0) 推荐(0)

求任意两个数间的质数个数
摘要:输入 数字个数n 最小从4开始,输出n 个升序排列的数字 输出任意两个数之间质数个数的总和 3 4 6 12 out: 6 不知道哪里错了,求解: #include <iostream>#include<string>#include<fstream>#include<math.h> using n 阅读全文

posted @ 2016-09-12 17:03 邗影 阅读(945) 评论(0) 推荐(0)

c++异常捕获
摘要:#include <iostream> #include <string> using namespace std; int main() { try { int value1,value2; //定义两个整型变量 cout<<"Pleaseinput two value:"<<endl; //提示 阅读全文

posted @ 2016-09-11 21:17 邗影 阅读(615) 评论(0) 推荐(0)

C++链表
摘要:复习到链表,写一个 这里一直困惑我的是&。。。本来认为&相当于*,,,,,,取内容,取地址。。。 但是写完了发现不是的,,,*&!=&(node *p); 他的意思只是说函数里我需要的是这个参数的引用,而不是副本。要的是目标本身。。 由于写中间插入删除要考虑前向指针,所以写个简单的,自己复习一下,, 阅读全文

posted @ 2016-09-11 17:32 邗影 阅读(248) 评论(0) 推荐(0)

c++泛型模板
摘要:模板是C++支持参数化多态的工具,使用模板可以使用户为类或者函数声明一种一般模式,使得类中的某些数据成员或者成员函数的参数、返回值取得任意类型。 模板是一种对类型进行参数化的工具; 通常有两种形式:函数模板和类模板; 函数模板针对仅参数类型不同的函数; 类模板针对仅数据成员和成员函数类型不同的类。 阅读全文

posted @ 2016-09-11 15:30 邗影 阅读(916) 评论(0) 推荐(0)

c++ stl常用
摘要:#include<iostream> #include<string> #include<vector> #include<list> #include<set> #include<iterator> #include<map> #include<fstream> #include <string> 阅读全文

posted @ 2016-09-10 21:38 邗影 阅读(191) 评论(0) 推荐(0)

c++流操作
摘要:非缓冲标准出错流对象cerr和缓冲标准出错流对象clog,它们都是来自于ostream类的对象,用于输出错信息。cerr和clog之间的不同之处在于cerr是不经过缓冲区直接向显示器输出有关信息,而clog则是先把信息放在缓冲区,缓冲区满后或遇上endl时向显示器输出。 转载 http://www. 阅读全文

posted @ 2016-09-10 20:06 邗影 阅读(683) 评论(0) 推荐(0)

函数指针和指针函数
摘要:#include <iostream> using namespace std; int (*ptr)(int a,int b);int fun(int x,int y){ int z; z=x>y?x:y; return z; } int fun3(int a){//传的是副本 cout<<"** 阅读全文

posted @ 2016-09-09 20:07 邗影 阅读(236) 评论(0) 推荐(0)

指针c艹
摘要:#include <iostream> using namespace std;int value=1;void func(int *p){ p=&value; }void func(int **p)。。。。。。。重载{ *p=&value; }int main(){ int a=3; int *p 阅读全文

posted @ 2016-09-09 19:11 邗影 阅读(166) 评论(0) 推荐(0)

汉诺塔,水仙花
摘要:#include <iostream> using namespace std; void hanno(char a,char b,char c,int s){ if(s==1) { cout<<a<<" "<<c<<endl; return; } else{ hanno(a,c,b,s-1); c 阅读全文

posted @ 2016-09-09 14:04 邗影 阅读(166) 评论(0) 推荐(0)

c++继承赋值兼容
摘要:其实还是不明白,红色部分,,,求解 #include <iostream>#include <time.h>using namespace std; class B0{public: void display() { cout<<"B0::display()"<<endl; }}; class B1 阅读全文

posted @ 2016-09-07 21:31 邗影 阅读(261) 评论(0) 推荐(0)

快速排序C++实现
摘要:注意红色部分为易错部分,蓝色部分的++不写也照样对,只不过每轮多比较一次已比过的数。还有q哨兵数一般选哪个都行,指的是一个数组里的数而不是数组下标,这里的返回值i=j,返回的是p哨兵位置(pivote)。当然你也可以让p=下标,不过这样每次交换后也要改变p.而在上式,p每次都是固定的。 #inclu 阅读全文

posted @ 2015-10-16 20:03 邗影 阅读(1924) 评论(2) 推荐(0)

归并排序/合并排序c++实现
摘要:#include #includeusing namespace std;class merges{public:void merge(int *a,int low,int mid,int high){ int i,j,k; i=low; j=0;//********** k... 阅读全文

posted @ 2015-10-16 18:29 邗影 阅读(321) 评论(0) 推荐(0)

3*(4+6)-7 # 用代码实现这个运算表达式,仅包含逆波兰式部分,算术结果部分未写出
摘要:#include#include#includeusing namespace std;void pr(char *str){ cout s1(strlen(str)); vector s2(strlen(str)); int i=0; while(str[i]!='\0')... 阅读全文

posted @ 2015-10-04 14:50 邗影 阅读(262) 评论(0) 推荐(0)

给出一个十六进制的数0xFF 0x80 (只有2“位”) 将其转换成有符号的一字节的十进制整数
摘要:#include #include#include #includeusing namespace std;int main(){ char ch[8]; char ch2[8]={'0','0','0','0','0','0','0','0'}; ltoa(strtol("0xb... 阅读全文

posted @ 2015-10-03 15:18 邗影 阅读(3557) 评论(0) 推荐(0)

给一字符串, 输出第一个出现两次的字母
摘要:package pack1; import java.util.Arrays;import java.util.Scanner; public class one { void search(String str){ int len=str.length(); char arr[]=str.toCh 阅读全文

posted @ 2015-09-30 12:56 邗影 阅读(752) 评论(2) 推荐(0)

链表创建途中遇到的问题
摘要:#include <iostream> #include<new> using namespace std; struct node{ int data; node *next; }; class list{ public: node *head; list(){head=null}; list(i 阅读全文

posted @ 2015-08-17 11:13 邗影 阅读(259) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6

导航