![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++编程
文章平均质量分 59
指尖热度
成绩会被遗忘,实力才是永恒,2481477481
展开
-
C++中文件类型 集成
.clw---- 以clw为扩展名的文件是用来存放应用程序中用到的类和资源的信息,这些信息是VC中的ClassWizard工具管理和使用类的信息来源readme.txt---- 这个文件每个应用程序都有一个,这个文件中列出了应用程序中用到的所有文件的信息,打开并查看其中的内容就可以对应用程序的文件结构有一个基本的知识.h----- 这种文件为头文件,包含的主要是类的定义原创 2013-11-15 10:47:03 · 867 阅读 · 0 评论 -
预处理命令 # 和 ##
// stl9.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#define contact(x,y) x##y#include "iostream"using namespace std;int _tmain(int argc, _TCHAR* argv[]){ int xy=10; int i=1;cout<<contact(x,y)<原创 2013-11-16 08:29:47 · 927 阅读 · 0 评论 -
ubuntu 10.10安装 下载软件仓库信息失败以及 3D效果设置方法
下载软件仓库信息失败网上也有很多建议,但是我是这样解决问题的:在系统栏打开 更新管理器点击 设置 点击 下载至点击选择最佳服务器,其自动匹配就能解决不能自动安装软件的问题了。ubuntu10.10 3D效果的设置:在 ubuntu 软件中心 里搜索compizconfig 软件,找到后 安装好,然后设置如下原创 2013-11-18 15:10:59 · 1470 阅读 · 0 评论 -
(1)汉诺塔
// sf1.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "iostream"using namespace std;void hanno(int n,char A,char B, char C){if(n==1){cout<<"move sheet "<<n<<"from "<<A<<"to "<<C<<endl;}e原创 2013-11-19 19:58:43 · 716 阅读 · 0 评论 -
(2)Fibonacci数列
// sf1.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "iostream"using namespace std;void hanno(int n,char A,char B, char C){if(n==1){cout<<"move sheet "<<n<<"from "<<A<<"to "<<C<<endl;}e原创 2013-11-19 20:07:55 · 783 阅读 · 0 评论 -
(4)蒙特卡罗法求圆周率
// sf5.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "time.h"#include "iostream"#define N 1000000using namespace std;int _tmain(int argc, _TCHAR* argv[]){ int i,sum=0; double x,y; s原创 2013-11-20 14:53:49 · 1186 阅读 · 0 评论 -
(5)计算程序耗时间
#include #include #include using namespace std;int main(int argc, char *argv[]){ long i=100000000L; clock_t start,finish; double waste; cout<< "Time to do "<<i<< "empty loops is "原创 2013-11-20 14:56:39 · 823 阅读 · 0 评论 -
(6)3n+1猜想 实现
3n+1猜想 小小测试原创 2013-11-20 15:01:20 · 1341 阅读 · 0 评论 -
(7)筛选求质数
// sf5.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "time.h"#include "iostream"#include "list"#include "queue"#define N 1000using namespace std;int _tmain(int argc, _TCHAR* argv[]){原创 2013-11-20 15:49:30 · 816 阅读 · 0 评论 -
(3)走迷宫(vector 和 struct两种分别实现)
// sf4.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"# include #include using namespace std;const int SIZE_X=10;const int SIZE_Y=10; bool initArray[SIZE_X][SIZE_Y]={ {false,false,false,false,fal原创 2013-11-20 11:14:39 · 1027 阅读 · 0 评论 -
(14)heap排序
//http://blog.csdn.net/sunboyiris#include "stdafx.h"#include "iostream"#include "time.h"using namespace std;#define MAX 1000#define SWAP(x,y) {int t;t=x;x=y;y=t;}void creatminheap(int []);//建立堆原创 2013-11-21 12:11:43 · 874 阅读 · 0 评论 -
(15)十二种排序算法总结
花费了一天,复习了一下排序算法,写了下面的这个代码,也给大家分享一下,转载请转出处。void selectsort(int[]);//选择排序void insertsort(int[]);//插入排序void bubblesort(int []);//冒泡排序void shellsort(int []);//希尔排序void shakersort(int []);//shake原创 2013-11-21 14:17:48 · 1112 阅读 · 0 评论 -
(10)插入排序
// sf9.cpp : 定义控制台应用程序的入口点。//http://blog.csdn.net/sunboyiris#include "stdafx.h"#include "iostream"#include "time.h"using namespace std;#define MAX 1000#define SWAP(x,y) {int t;t=x;x=y;y=t;}vo原创 2013-11-21 09:34:30 · 723 阅读 · 0 评论 -
(11)冒泡排序
// sf9.cpp : 定义控制台应用程序的入口点。//http://blog.csdn.net/sunboyiris#include "stdafx.h"#include "iostream"#include "time.h"using namespace std;#define MAX 1000#define SWAP(x,y) {int t;t=x;x=y;y=t;}vo原创 2013-11-21 09:42:32 · 682 阅读 · 0 评论 -
(13)shaker 排序
Shaker排序又叫鸡尾酒排序或双向冒泡排序,它是冒泡排序的一种改进。与冒泡排序相同,Shaker排序也是一种稳定排序算法。不同的是,普通的冒泡排序算法仅是从低到高比较序列里的每个元素,或者说普通的冒泡排序算法只能每次从前向后按一个次序进行遍历,Shaker排序每次遍历包括两个方向,先从前向后再从后向前,在从前往后遍历后能记录最后发生交换的两个元素位置,从后往前遍历时就从这个位置开始。这种双向交替原创 2013-11-21 10:18:45 · 792 阅读 · 0 评论 -
(9)选择排序
// sf9.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "iostream"#include "time.h"using namespace std;#define MAX 1000#define SWAP(x,y) {int t;t=x;x=y;y=t;}void selectsort(int[]);//选择排序voi原创 2013-11-21 09:15:50 · 744 阅读 · 0 评论 -
(8)斐波那契实现三种方法
// sf8.cpp : 定义控制台应用程序的入口点。//http://blog.csdn.net/sunboyiris#include "stdafx.h"#include #include #include #include using namespace std;long fun(int n){ if((n==1)|(n==2)) return 1;原创 2013-11-21 08:51:55 · 1427 阅读 · 0 评论 -
(12)希尔排序
//http://blog.csdn.net/sunboyiris#include "stdafx.h"#include "iostream"#include "time.h"using namespace std;#define MAX 1000#define SWAP(x,y) {int t;t=x;x=y;y=t;}void shellsort(int []);//希尔排序原创 2013-11-21 10:02:36 · 753 阅读 · 0 评论 -
STL (1)for_each 函数
/* // TEMPLATE FUNCTION for_each//template<class _InIt, class _Fn1> inline _Fn1 for_each(_InIt _First, _InIt _Last, _Fn1 _Func) { // perform function for each element _DEBUG_RANGE(_First, _Las原创 2013-11-22 10:19:25 · 826 阅读 · 0 评论 -
STL(2)find函数
#include "stdafx.h"/*// TEMPLATE FUNCTION findtemplateinline _InIt _Find(_InIt _First, _InIt _Last, const _Ty& _Val) { // find first matching _Val _DEBUG_RANGE(_First, _Last); for (; _First !原创 2013-11-22 10:26:23 · 960 阅读 · 0 评论 -
STL(3) find_if函数
/*// TEMPLATE FUNCTION find_iftemplate<class _InIt, class _Pr> inline _InIt _Find_if(_InIt _First, _InIt _Last, _Pr _Pred) { // find first satisfying _Pred _DEBUG_RANGE(_First, _Last); _DEBUG_P原创 2013-11-22 10:32:18 · 1021 阅读 · 0 评论 -
STL(5)find_first_of函数
/*// TEMPLATE FUNCTION find_first_oftemplate<class _FwdIt1, class _FwdIt2> inline _FwdIt1 _Find_first_of(_FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2) { // look for one of [原创 2013-11-22 11:09:42 · 788 阅读 · 0 评论 -
STL(4)adjacent_find函数
/* // TEMPLATE FUNCTION adjacent_findtemplate inline _FwdIt _Adjacent_find(_FwdIt _First, _FwdIt _Last) { // find first matching successor _DEBUG_RANGE(_First, _Last); for (_FwdIt _Firstb; (_Fir原创 2013-11-22 10:56:01 · 888 阅读 · 0 评论 -
STL(6)sorting algorithm 函数
//*********************by vincent http://my.csdn.net/sunboyiris ************************//#include "stdafx.h"#include "time.h"#include "iostream"#include "algorithm"#include "vector"using names原创 2013-11-22 11:40:09 · 856 阅读 · 0 评论 -
ZJU1088
// 1088.cpp : Defines the entry point for the console application./**************************************//**************joseph环问题************//**************************************/#include "st翻译 2013-11-25 15:14:25 · 690 阅读 · 0 评论 -
error C2065: “cout”: 未声明的标识符 处理方法
编译出现这个问题#include "stdafx.h"#include "iostream"using namespace std;int main( ){ cout<<34<<endl; return 0;}添加一行代码:using namespace std;编译原创 2013-11-14 15:44:59 · 7602 阅读 · 1 评论 -
函数模板C++
// stl2.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"template void swap(T &a, T &b);int _tmain(int argc, _TCHAR* argv[]){int a=10,b=30;swap(a,b);printf("%d,%d\n",a,b);double c=12.23,d=34.56;s原创 2013-11-14 15:31:26 · 785 阅读 · 0 评论 -
头文件管理C++
#ifndef COORDIN_H_#define COORDIN_H_struct polar{double distance;double angle;};struct rect{double x;double y;};polar rect_to_polar(rect xypos);void show_polar(polar dapos);#endif#i原创 2013-11-14 16:46:39 · 1137 阅读 · 0 评论 -
完美散列函数(一)
// cxy1.cpp : Defines the entry point for the console application.//#include "stdafx.h"/*--- birthday.c --------------------------- Listing 3-1 -------- * Reads input file of birthdays and lists翻译 2013-12-17 14:57:37 · 1135 阅读 · 0 评论 -
大数运算之乘法函数
void mult(char a[],char b[],char s[]){ int i,j,k=0,alen,blen,sum=0,res[65][65]={0},flag=0; char result[65]; alen=strlen(a);blen=strlen(b); for (i=0;i<alen;i++) for (j=0;j<blen;j+原创 2014-01-13 20:11:29 · 773 阅读 · 0 评论 -
大数运算-加减函数
void add(char a[],char b[],char back[]){ int i,j,k,up,x,y,z,l; char *c; if (strlen(a)>strlen(b)) l=strlen(a)+2; else l=strlen(b)+2; c=(char *) malloc(l*sizeof(char)); i=strlen(a)-原创 2014-01-13 20:13:08 · 770 阅读 · 0 评论 -
MFC(4)自绘按钮
#pragma once#include "afxwin.h"class CMyButton : public CButton{//DECLARE_DYNAMIC(CMyButton)public:CMyButton();virtual ~CMyButton();//设置Button Down的背景颜色 void SetDownColor(COLORREF color)转载 2013-11-15 12:28:01 · 1156 阅读 · 0 评论 -
OpenMP编程->并行循环
//for循环并行化声明形式1 #pragma omp parallel for for (int i=0;i<10;i++) { cout<<i<<" "<< omp_get_thread_num()<<endl; } //for循环并行化声明形式2#pragma omp parallel { #pragma omp for for (i原创 2014-04-13 14:46:32 · 879 阅读 · 0 评论 -
OpenCV编程->OpenMP优化入门
OpenCV编程->OpenMP优化入门原创 2014-04-13 21:14:07 · 1281 阅读 · 0 评论 -
OpenMP编程->互斥锁函数
OpenMP编程->线程同步互斥锁函数原创 2014-04-13 18:15:07 · 1702 阅读 · 2 评论 -
OpenMP编程->调度优化
void test20(){#pragma omp parallel for schedule(static, 2) //static调度策略,for循环每两次迭代分成一个任务 for (int i = 0; i < 10; ++i) //被分成了5个任务,其中循环0~1,4~5,8~9分配给了第一个线程,其余的分配给了第二个线程 { std::cout << "Threa原创 2014-04-13 18:38:43 · 816 阅读 · 0 评论 -
C++编程->内存函数
alloca包含在头文件malloc.h中,在某些系统中会宏定义成_alloca使用。 注意: 1)在调用 alloca的函数返回的时候, 它分配的内存会自动释放。也就是说, 用 alloca 分配的内存在栈上。所以释放不需要用户使用free。 2)alloca不具可移植性,而且在没有传统堆栈的机器上很难实现。当它的返回值直接传入另一个函数时会带来问题,因为他分配在栈原创 2014-04-14 21:45:55 · 695 阅读 · 0 评论 -
Lua编程->C++内嵌Lua编程
Lua编程->VS2008内嵌Lua编程原创 2014-04-15 11:05:21 · 1750 阅读 · 0 评论 -
Python编程->cannot open file 'python27_d.lib'
在把python库添加进VS2008里面去时,遇到一个问题如下:1>------ Build started: Project: python, Configuration: Debug Win32 ------1>Compiling...1>python.cpp1>Linking...1>LINK : fatal error LNK1104: cannot open file 'py原创 2014-04-15 09:16:56 · 11135 阅读 · 0 评论 -
windows编程->多线程与同步
在此引入几个函数:原创 2014-04-29 20:35:45 · 776 阅读 · 0 评论