摘要: CString->std::string 例子:CString strMfc=“test“;std::string strStl;strStl=strMfc.GetBuffer(0);std::string->CString例子:CString strMfc;std::string strStl=“test“;strMfc=strStl.c_str(); 阅读全文
posted @ 2014-01-15 17:20 清凉一夏o0 阅读(228) 评论(0) 推荐(0) 编辑
摘要: { CString FilePathName; CFileDialog dlg(TRUE);///TRUE为OPEN对话框,FALSE为SAVE AS对话框 if(dlg.DoModal()==IDOK) FilePathName=dlg.GetPathName(); } 文件名保存在了FilePathName里,然后处理吧上面内容来自百度知道,去给amote258点个赞吧。-------------------我是分割线----------------上面只是最简单的用法,那么更复杂的用法包括指定扩展名等等。下面是CFileDialog的详解:CFileDialog类封装了Windo... 阅读全文
posted @ 2014-01-15 16:25 清凉一夏o0 阅读(2872) 评论(0) 推荐(0) 编辑
摘要: socket可以看成是一种特殊的文件,所以可以通用“open--read/write--close”模式来操作。socket()函数对应于普通的open()函数,用于创建一个socket。原型 intsocket(int domain, int type, int protocol);domain :协议域/协议族(family) type:指定socket类型 protocol :指定协议,一般默认为0,默认使用与type对应的协议bind()函数:把一个特定的地址赋给socket,即把"IP地址+端口号"与socket绑定。原型intbind(int sockfd, c 阅读全文
posted @ 2014-01-13 13:55 清凉一夏o0 阅读(297) 评论(0) 推荐(0) 编辑
摘要: OSG的sample里面有OSG+MFC+MDI的例子。网上有说OSG+MFCSDI的例子,如http://blog.csdn.net/xuguangsoft/article/details/8164104这里我说一下怎么在MFC对话框上结合使用OSG。首先,对话框要保持干净,像酱紫:然后,在你里osg sample里面找到那个OSG+MFC+MDI的例子(osgviewerMFC),在里面找两个文件:MFC_OSG.h 和MFC_OSG.cpp。把这两个文件拷到你自己的对话框项目的源代码目录下,然后在IDE里面添加到项目中。接下来:在你的 stdafx.h 中添加上 #include在你的工 阅读全文
posted @ 2014-01-05 10:26 清凉一夏o0 阅读(4441) 评论(3) 推荐(1) 编辑
摘要: 代码如下:#include #include #include #define N 50000void merge(int [],int,int,int);//归并排序数组合并函数声明void mergesort(int [],int,int);//归并排序数组排序函数声明//主函数int main(){ int i,a1[N]; double t1,t2,t3,t4; for(i=0;imiddle) for(k=j;k<=high;k++) { b[i]=a[k]; i++; } else { ... 阅读全文
posted @ 2013-12-05 15:46 清凉一夏o0 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 代码如下:#include using namespace std; void BubbleSort(int *list,int len){ int i,j,temp; for(i=0;ilist[j+1]) { temp=list[j]; list[j]=list[j+1]; list[j+1]=temp; } }} int main (){ int list[10]; int n=10,m=0; cout>list... 阅读全文
posted @ 2013-12-05 15:42 清凉一夏o0 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 代码如下:#include int binary_search(int array[], int value, int size) { int found = 0; int high = size, low = 0, mid; mid = (high + low) / 2; printf("\n\nLooking for %d\n", value); while ((! found) && (high >= low)) { printf("Low %d Mid %d High %d\n", low, mid, high); if ( 阅读全文
posted @ 2013-12-05 15:40 清凉一夏o0 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 质数就是只能被1和自身整除的数。1是质数。#include using namespace std;const int UP = 100;bool is(int a){ for(int j=2; j<a; j++) { if(a%j == 0) { return false; } }}void main(){ cout<<1<<endl; for(int i=3; i<=UP; i++) { if(is(i)) { cout<<i<<endl; ... 阅读全文
posted @ 2013-10-19 23:04 清凉一夏o0 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 题目:看下面的代码,求输出结果。void foo(int n){ if(n>0) { foo(n-1); cout<<n<<endl; foo(n-2); }}void main(){ foo(4);}输出结果:1 2 3 1 4 1 2 阅读全文
posted @ 2013-10-19 11:12 清凉一夏o0 阅读(336) 评论(0) 推荐(0) 编辑
摘要: STL(Standard Template Library)是C++的标准模版库。STL概述STL的一个重要概念是数据结构和算法的分离,这使得STL变得十分通用。例如:由于STL的sort()函数是完全通用的,所以你可以用它来操作几乎任何数据集合,包括链表,容器和数组。http://net.pku.edu.cn/~yhf/UsingSTL.htm 阅读全文
posted @ 2013-10-08 22:15 清凉一夏o0 阅读(179) 评论(0) 推荐(0) 编辑