自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(51)
  • 资源 (2)
  • 收藏
  • 关注

原创 循环打印一个目录下的所有文件。调用IO中的File

import java.io.File ;import java.io.IOException ;public class FileDemo11{public static void main(String args[]){File my = new File("d:" + File.separator) ;// 操作路径print(my) ;}public sta

2013-05-17 20:52:01 196

原创 操作系统学习之路一

通过《深入理解操作系统》一书,我现在学习到第三章,对于第二章中的我学到了移码,以及数在机器中的表示方式,对于计算的溢出的判断等等有了进一步的了解,,,,,,,,,,好了,明天再详细的写,,今天到此

2012-11-22 23:20:01 150

转载 『转』 函数、变量命名方法

原文转自:http://blog.csdn.net/apple_guet/article/details/6721186  代码永远会有BUG,在这方面没有最好只有更好。高效是程序员必须作到的事情,无错是程序员一生的追求。复用、分而治之、折衷是代码哲学的基本思想。模块化与面向对象是实现高效无错代码的方法。高效无错代码需要思想与实践的不断反复。1.2.1 命名约定    命令规范基本

2012-11-17 20:33:17 142

转载 Qt学习之路12(转)

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://devbean.blog.51cto.com/448512/205034在前面的QMainWindow的基础之上,我们开始着手建造我们的应用程序。虽然现在已经有一个框架,但是,确切地说我们还一行代码没有写呢!下面的工作就不那么简单了!在这一节里面,我们要为我们的框架添加

2012-09-23 10:51:24 69

原创 两个数字第一个不相等的元素

#include #include using namespace std;int main(){    int a1[]={1,2,3,4,5,6};    int a2[]={1,2,3,2,3,3};    pairb = mismatch(a1,a1+6,a2);    cout    return 0;}

2012-09-14 16:06:26 100

原创 最长公共字串

#include #include #include using namespace std;int main(){    string a;    string b;    cin >> a;    cin >> b;    int n1, n2;    n1 = a.length();    n2 = b.length();

2012-09-14 16:05:51 112

原创 get系列

#include using namespace std;int main(){    char *a = new char;    cin.getline(a,10);//读取一行,提取界定符    cout    cin.get(a,10);//读取一行,不提取界定符,,,cin.ignore(),,,清除缓冲区    cout

2012-09-14 16:05:15 126

原创 处理流错误

#includeusing namespace std;int main(){    int a;    cout    cin>>a;    cout    if(cin.good())    {        cout    }    if(cin.fail())    {        cout    }

2012-09-14 16:04:52 194

原创 将文本按行显示

#include #include using namespace std;int main(){    cout    char s[100];    ifstream in("a.txt");    if(!in)    return 0;    while(in.getline(s,100))    {        cout

2012-09-14 16:04:30 633

原创 单词统计

#include #include #include #include #include #include using namespace std;class CWord{    string word;public:    CWord(string word)    {        this->word = word;

2012-09-14 16:04:08 190

原创 重载运算符一

重载操作符是具有特殊名称的函数:保留字operator后接需定义的操作符号。像任意其他函数一样,重载操作符具有返回类型和形参表,如下语句:Sales_item operator+(const Sales_item&,const Sales_item&);声明了加号操作符,可用于将两个Sales_item对象相加并获得一个Sales_item对象的副本。不能重载的操作符::

2012-09-14 16:03:38 230

原创 find查询函数

#include #include #include using namespace std;bool tian(int n){    return n>5;}int main(){    vector a;    vector v;    for(int i = 0; i     {        a.push_back(i

2012-09-14 16:03:10 124

原创 计数

#include #include #include using namespace std;bool tian(int i){    return i }int main(){    vector a(10,5);    for(int i = 0; i     {        a.push_back(i);    }    cout

2012-09-14 16:02:49 96

原创 绪论

数据数据是信息的载体,在计算机科学中是指所有能输入到计算机并能被计算机程序识别和处理的符号集合。数据元素数据元素也称为节点,是表示数据的基本单位,在计算机程序中通常作为一个整体进行考虑和处理数据项数据项是构成数据元素的不可分割的最小单位。数据对象数据对象是具有相同性质的数据元素的集合,是数据的子集数据结构数据结构是指相互之间存在一

2012-09-14 16:02:23 198

原创 将文本输入到文件

#include #include using namespace std;struct S{    char name[20];    int grade;};int main(){    ofstream out;    out.open("a.txt");    S s1 = {"田宏增",90};    S s2 =

2012-09-14 16:01:59 95

原创 字符串流

#include #include using namespace std;int main(){    int n;    float f;    string s;    string st = "1 .3 666";    istringstream t(st);    stringstream t1;    t>>n;    t>>f

2012-09-14 16:01:38 135

原创 字符串相似度

#include #include #include using namespace std;//算法int ldistance(const string source,const string target){    //step 1    int n=source.length();    int m=target.length();

2012-09-14 16:01:19 105

原创 先写入文件在读入屏幕

#include #include using namespace std;int main(){    fstream in_out;    in_out.open("a.txt",ios::in|ios::out|ios::trunc);    in_out.write("hello",5);    in_out.seekg(0,ios::beg

2012-09-14 16:00:49 382

原创 迷宫求解

#include #include #include #include #include #include using namespace std;struct PathUnit{    int x;    int y;    int direct;};class MyMaze{    vector >vecMaze;

2012-09-14 16:00:15 163

原创 关联迭代器

关联容器两个基本的关联容器map和set如果希望有效的存储不同值的集合,那么使用set容器比较合适,而map容器则更适用于需要存储(乃至修改)每个键所关联的值的情况。在做某种文本处理时,可使用set保存要忽略的单词,而字典则是map的一种很好的应用:单词本身是键,而他的解释说明是值set和map类型的对象所包含的元素都具有不同的键,不允许为同一个键添加第二个元素。如果一个键必须

2012-09-13 10:32:27 129

原创 N皇后

# include int main(){    int a[10], n, i = 1, b;    a[1] = 1;    scanf("%d", &n);    while(1)    {        b = 1;        for(int j = i - 1; j >= 1; j--)        {

2012-09-08 21:38:38 660

原创 集合划分

#include using namespace std;int f(int n,int m)//对n个数划分为m个{    if(m==1||n==m)        return 1;    else        return f(n-1,m-1)+f(n-1,m)*m;//第m个为单独元素和地m个为非独立元素}int main()

2012-09-08 16:26:19 127

原创 图的邻接表存储以及深度和广度遍历

#include #include using namespace std;struct ArcNode{    int adjvec;//邻接点域    ArcNode *next;};struct VertextNode//定义顶点表节点{    int vertex;    int visited;    ArcNode *fi

2012-09-07 21:07:34 227

原创 简单实现了数学运算的先后问题

#include #include #include #include using namespace std;int precede(const char a){    switch(a)    {        case'+':    case'-':        return 0;    case'*':    case'

2012-09-05 23:54:44 161

原创 有重复数字的排列

#include using namespace std;int a[4] = {0,0,1,1};void tian(int m, int n){ if(m == n) {  for(int i = 0; i   {   cout   }  cout  return; } else{  for(int i = m; i   {

2012-09-04 20:54:01 146

原创 整数划分

#include using namespace std;int x[10]={100};void f(int a,int b){ if(0==a) {  for(int i = 0; i  {   cout  }  cout  return; } for(int i = a; i > 0; i--) {  if((b-1>=0) &

2012-09-04 19:51:21 84

原创 模板的简单使用

#include using namespace std;template int tian(T t1, T t2){    if(t1>t2)        return 1;    if(t1        return -1;    return 0;}int main(){    cout    cou

2012-09-03 23:06:45 96

原创 面向对象编程一

面向对象编程的关键思想是多态性。之所以称通过继承而相关联的类型为多态性,是因为在许多情况下可以互换地使用派生类型或基类型的许多形态动态绑定动态绑定我们能够编写程序使用集成层次中任意类型的对象,无须关系对象的具体类型。使用这些类的程序无须区分函数是在基类还是在派生类中定义的基类通常应将派生类需要重定义的任意函数定义为虚函数。有时作为基类的类具有的一些成员,它希

2012-09-03 22:58:25 102

原创 重载运算符(一)

重载操作符是具有特殊名称的函数:保留字operator后接需定义的操作符号。像任意其他函数一样,重载操作符具有返回类型和形参表,如下语句:Sales_item operator+(const Sales_item&,const Sales_item&);声明了加号操作符,可用于将两个Sales_item对象相加并获得一个Sales_item对象的副本。不能重载的操作符::

2012-08-29 22:58:30 113

原创 赫夫曼编码

#include #include using namespace std;struct tree{    int weight;//权值    int rchild;//右孩子    int lchild;//左孩子    int parent;//父亲};void g(vector &t){    int size = t.s

2012-08-21 01:32:34 198

原创 istrstream

#include #include #include using namespace std;int main(){    istrstream s("1.01 47 47 47");    int i;    float f;    s>>i>>f;    char buf2[100];    s>>buf2;    cout

2012-08-19 23:36:19 120

原创 ostrstream

#include #include #include using namespace std;int main(){    cout    int i;    float f;    cin>>i>>f;    cin>>ws;    char buf[100];    cin.getline(buf,100);

2012-08-19 23:35:45 142

原创

类背后蕴含的思想是数据抽象和封装数据抽象和封装的好处1,避免类内部出现无意的、可能破坏对象爱你个状态的用户级错误。2,随时间推移可以根据需求改变或缺陷报告来完美类实现,而无需改变用户级代码类的定义已分号结束。分号是必需的,因为在类定义之后可以接一个对象定义列表。定义必须已分号结束。通常,将对象定义成类定义的的一部分是一个坏主意。这样做,会使所发生的操作难以理解。对读者而言,将两

2012-08-19 00:04:44 422

原创 输出流连接到输入流

ifstream in("to.txt");  assert(in);  ofstream out("from.txt");  assert(out);  out

2012-08-17 07:44:25 119

原创 将输入的int类型的数按奇偶性输出到文件

#include #include #include #include #include using namespace std;void split1(istream_iterator beg,istream_iterator end, ostream_iteratorfirst,ostream_iteratorsecond){   while(b

2012-08-16 23:09:38 144

原创 输出流的简单使用

#include#include#include#includeusing namespace std;int main(){    ostream_iterator out_iter(cout,"\n");    istream_iterator in_iter(cin), eof;    while(in_iter!=eof)        *(

2012-08-16 23:09:12 94

原创 对数字进行排序并删除其中相等的

#include #include #include #include using namespace std;int main(){    istream_iterator cin_it(cin), end_of_stream;    vector v(cin_it,end_of_stream);    ostream_iterator o(c

2012-08-16 23:08:28 275

原创 排除重复单词2

#include #include #include #include #include #include using namespace std;int main(){    listword;    string next_word;    while(cin>>next_word)    {        word.push

2012-08-16 23:07:50 127

原创 iterator的简单使用

#include #include #include #include #include using namespace std;int main(){    vector v;    listl;    for(int i = 0; i     {        v.push_back(i);    }    for(int

2012-08-16 23:07:07 89

原创 迭代器算法2

插入迭代器:这类容器可与容器绑定在一起实现在容器中插入元素的功能iostream迭代器:这类容器可与输入或输出流绑定在一起,用于迭代器遍历。反向迭代器:这类迭代器实现向后遍历,而不是向前遍历。所有容器类型都定义了自己的reverse_iterator类型。有rbegin和rend成员函数返回back_iterator,创建使用push_back实现插入的迭代器。fron

2012-08-16 23:06:32 303

程序员考试辅导

内含往年的考试题目的地址,以及考试范围,部分题目详解,很好,很强大

2012-09-03

空空如也

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

TA关注的人

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