上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: C++ 通过以下几个类支持文件的输入输出:ofstream: 写操作(输出)的文件类 (由ostream引申而来) ifstream: 读操作(输入)的文件类(由istream引申而来) fstream: 可同时读写操作的文件类 (由iostream引申而来) 打开文件(Open a file)对这些类的一个对象所做的第一个操作通常就是将它和一个真正的文件联系起来,也就是说打开一个文件。被打开的文件在程序中由一个流对象(stream object)来表示 (这些类的一个实例) ,而对这个流对象所做的任何输入输出操作实际就是对该文件所做的操作。要通过一个流对象打开一个文件,我们使用它的成员函数o 阅读全文
posted @ 2012-05-05 14:56 MFT 阅读(10084) 评论(0) 推荐(1) 编辑
摘要: #include <fstream> ,相当于是引用标准C++的头文件,ifstream是标准C++的STL中的类,STL中的类都是定义在std这个名字空间中。 所以std::ifstream sitelist( "sitelist ",ios::nocreate); 就是使用std这个名字空间中定义的ifstream这个类,而且这样使用这个类就没有出现在全局名字空间中。 而 #include <fstream.h> ,相当于使用了VC实现的C++提供的头文件,此时ifstream虽有相同的功能,可是他现在相当于是全局名字空间中定义的了。相当于: : 阅读全文
posted @ 2012-05-05 14:52 MFT 阅读(4684) 评论(0) 推荐(0) 编辑
摘要: C++ 类中的静态变量转自http://blog.csdn.net/zieckey/archive/2006/11/23/1408767.aspx作者:zieckey 一切权利归作者所有静态数据成员:下面看一个例子:#include <iostream.h>class Point{public:void output(){}static void init(){ } };void main( void ){Point pt;pt.init();pt.output(); }这样编译是不会有任何错误的。下面这样看#include <iostream.h>class Poin 阅读全文
posted @ 2012-05-05 09:57 MFT 阅读(9908) 评论(1) 推荐(0) 编辑
摘要: // string.h.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "stdio.h"#include <iostream>#include "string.h"#include <string>using namespace std;void main(){char * y="qqq",*x="qqq";char p[5]="aaaa",*a="qqqqq";char *b= 阅读全文
posted @ 2012-05-04 22:03 MFT 阅读(244) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include "string.h"using namespace std;void main(){char p[10]="aaaa",*a="qqqqq";char *b=strcat(p,a);cout <<b<<"--"<<strlen(p)<<"————"<<p[5]<<"--"<<endl; for(int i=0;i<str 阅读全文
posted @ 2012-05-04 20:09 MFT 阅读(263) 评论(0) 推荐(0) 编辑
摘要: Will E-book Replace Traditionnal Books Recent years have seen the rapid development of information technology .As a result , many electronic inventions ,including e-books,have found their way into our daily life and have gained increasing popularity among common people. it is no wonder that somepeo. 阅读全文
posted @ 2012-05-04 15:10 MFT 阅读(431) 评论(0) 推荐(0) 编辑
摘要: 这个题就是求出所有结点的距离之后,再找出某个结点,该结点离其它结点的最大距离是所有结点中是最小的...解法1:深搜出所有结点间的距离,但是会超时,即使深搜的过程使用中记忆化搜索(就是用2维数组保存已经搜出的答案,如果后面的搜索需要用到直接使用即可)...解法2:Floyd算法,3重循环直接找出所有结点之间的最短距离解法3:对每一个结点应用一次迪杰斯特拉算法,找出所有结点与其它结点间的最短距离...解法2:#include <stdio.h>#include <string.h>#define MAX (100 + 10)#define INF (1000000 + 10 阅读全文
posted @ 2012-05-04 08:01 MFT 阅读(232) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.SqlClient;using System.Configuration;using System.Data;namespace SQlHelper登录{ class SQlHelper { public static int ExecuteNonQuery(string sql ,params SqlParameter [] parameters) { string constr = Conf. 阅读全文
posted @ 2012-05-03 21:38 MFT 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 问:sql="select * from banzhu_manage ";adapter=new SqlDataAdapter(sql,banzhu_conn);adapter.Fill(banzhu_ds,"banzhu_manage");上面是我在爱适配器,中对DATASET进行填充,要是我想在DATASET中添加另一个数据库中已经存在的表该怎么做?______________________________________________________________________________________________答1:还用这个: 阅读全文
posted @ 2012-05-03 20:33 MFT 阅读(1607) 评论(0) 推荐(0) 编辑
摘要: #include <string.h>using namespace std;void main(){ string str="dfs"; const char * c1 = str.c_str();//cout<<c1; char *p=new char[3]; cout<<strlen(p)<<"==="<<str.length()<<"--";str.copy(p,str.length(),0);p[str.length()]='\0';co 阅读全文
posted @ 2012-05-03 13:54 MFT 阅读(134) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页