C/C++
文章平均质量分 66
dic_008
这个作者很懒,什么都没留下…
展开
-
map容器的使用
#include#include #include #include using namespace std;int main(){bool con=0;do{map > children;string surname,childName;do {coutcin>>surname;if(!cin)break;vecto转载 2011-10-19 17:15:17 · 376 阅读 · 0 评论 -
当前路径获取的问题
函数:DWORD GetCurrentDirectory( DWORD nBufferLength, // size, in characters, of directory buffer LPTSTR lpBuffer // pointer to buffer for current directory);获得可执行文件当前路径,使用过程中可能会出现这样的问题:原创 2012-02-20 13:03:26 · 357 阅读 · 0 评论 -
递归遍历文件夹查找文件
void IsFindFile(CString strPatn, CString strwjm){ CFileFind fileFind; CString NextDir; CString Directory(strPatn); Directory += "\\*.*"; BOOL bResult = fileFind.FindFile(原创 2012-02-20 13:28:27 · 1263 阅读 · 0 评论 -
一道面试题
同学去面试,一道面试题没做出来回来给我们讲了下,早上起床做一下。#include #include using namespace std;int main(){ int n,m,i,j; int count=1; int **p=NULL; bool **q=NULL; cout<<"输入一个数n:"<<endl; cin>>n; m原创 2011-12-12 09:14:15 · 440 阅读 · 0 评论 -
大小端存储的问题
今天看见论坛中有人发表一段代码:#includeint main(){ int a='abc'; printf("%s\n",&a); return 0;}这段代码输出cba,a=6382179,abc对应的十六进制为ox00616263,整形存储单元对应的ASCII码为000 097 098 099。若是机器为小端存储模式(数据的原创 2011-11-07 23:56:39 · 564 阅读 · 0 评论 -
复习数据结构链表插入排序
void LinListSort(SLNode *head){ SLNode *curr,*pre,*p,*q; p=head->next; head->next=NULL; while (p!=NULL) { curr=head->next; pre=head; while (curr!=NULL&&curr->datadata) {转载 2011-11-01 22:07:01 · 468 阅读 · 0 评论 -
利用ADO连接数据库
#import "C:\Program Files\Common Files\System\ado\msado15.dll"no_namespace \rename("EOF","adoEOF")rename("BOF","adoBOF")//添加动态链接库,并对结尾指示符进行更名避免与系统中的重复class ADOConn {public: BOOL ExecuteSQL(_bs翻译 2011-10-28 11:46:22 · 2983 阅读 · 0 评论 -
容器的综合应用:文本查询程序
对查询类的编写:class TextQuery {public: TextQuery(); virtual ~TextQuery(); typedef std::vector::size_type line_no; //起个别名要么太长让人看着蛋疼 void read_file(std::ifstream &is) { store_file(is);转载 2011-10-24 19:02:20 · 501 阅读 · 0 评论 -
对字符串的操作
//找出子串sub_str在str中出现的次数int find_str_n(const char *str,const char *sub_str){ int len=0,k=0; int count=0; while (str[k]!='\0') { if (str[k]==sub_str[len]) { k++; len++; if原创 2011-10-26 13:04:29 · 381 阅读 · 0 评论 -
类模板编程示例一
allege.h头文件#ifndef _ALLEGE_H#define _ALLEGE_H#include#include#includeinline void allege_error(int arg,const char* msg){ if (!arg) { fprintf(stderr,"error: %s\n",msg);#ifdef原创 2012-08-28 19:59:14 · 500 阅读 · 0 评论