
C++程序
KarlDoenitz
这个作者很懒,什么都没留下…
展开
-
C++程序
// migong.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"///////////////////////////////////////////////////#include #include #include //////////////////////////////////////////////////////原创 2012-04-25 21:54:44 · 906 阅读 · 0 评论 -
数据结构——KMP算法C++版
#include "stdafx.h"#include using namespace std;void get_next(char*t, int next[ ]){ int t_len=strlen(t); int i=0; //求解每个next[i] next[0]=-1; //递推基本条件,然后求解next[i+1] int j=-1; //向后递推位原创 2012-10-16 13:11:49 · 6231 阅读 · 1 评论 -
数据结构链表队列
// 链表.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;class student{public: int num; student *next;};int n;student *create(void){ cout<<"创建链表"<<endl; student *原创 2012-10-21 16:06:14 · 854 阅读 · 0 评论 -
江南style各种版本史上最牛合集——C++/C语言KMP解析字符串——程序版style
// kmpDlg.cpp : implementation file//#include "stdafx.h"#include "kmp.h"#include "kmpDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////原创 2012-11-04 15:41:20 · 1766 阅读 · 0 评论 -
C++/C语言中链表队列与栈
// 链表、队列和栈.cpp : 定义控制台应用程序的入口点。#include "stdafx.h"#include using namespace std;class Student{public: int num; Student *head,*end,*next,*pre;};static int i = 0;Student *creat(void){ Stud原创 2012-10-30 17:29:31 · 2099 阅读 · 1 评论 -
C++编程学习数据结构二叉树
// biTree.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include ;using namespace std;typedef struct bitnode{ int data; struct bitnode *lchild,*rchild;}*bitree,tree;bitree *t;int number=0翻译 2012-11-13 20:26:46 · 2878 阅读 · 0 评论 -
C++二叉树的建立与遍历
从别处找来几个例子,感觉还可以,同学们拿回去看看吧,有什么地方不懂可以下可以后来实验室问我。//==========================================定义头部#include using namespace std;struct BiTNode{ char data; struct BiTNode *lchild, *rchild;//左右孩子};BiT翻译 2012-11-13 20:51:36 · 50472 阅读 · 0 评论 -
工信部软件大赛及C++基本教程
#include #include "cmath"using namespace std;int f(int n, int a[], int idx){ if(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]==n) return 1; // 填空1——这行代码用来判断四个数的平方和是否等于n if(idx==4) return 0; for(in原创 2012-11-16 15:15:17 · 2875 阅读 · 0 评论 -
二叉树的创建,节点删除,节点增加
// 二叉树.cpp : 定义控制台应用程序的入口点。///**二叉树作业*2012.12.1 13:55*Made By Karld Vorn Doenitz*/#include "stdafx.h"#include#includeusing namespace std;class TreeNode{//建立节点类public: char num;原创 2012-12-01 16:47:00 · 10727 阅读 · 3 评论 -
黑白界面下去的小游戏
今天收大一学生的启发,自己也来写一个黑白界面下的小游戏让大家看看,主要是给大一的学子们,大家努力啦!#include #include using namespace std;int c=1,d=1;int a[9][20]={//建立地图 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, {1,2,0,0,0,0,0,0,0,0,0,0,0,0,0原创 2012-11-22 21:23:56 · 1602 阅读 · 0 评论 -
C++快速排序
// 快速排序.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include#define N 100using namespace std;double a[N];void fast_sortI(double *a,int begin,int end){ if(begin<end) { int原创 2013-03-16 16:56:46 · 3171 阅读 · 0 评论 -
字符串的快速排序和二分查找
#include "stdafx.h"#include#include #define N 100using namespace std;string a[N];void fast_sortI(string *a,int begin,int end){ if(begin<end) { int i =begin,j=end;原创 2013-03-17 14:31:40 · 3397 阅读 · 0 评论 -
C++中调用库函数实现快速排序
一、对int类型数组排序int num[100];Sample:int cmp ( const void *a , const void *b ) { return *(int *)a - *(int *)b; }qsort(num,100,sizeof(num[0]),cmp);二、对char类型数组排序(同int类型)char wor原创 2013-03-24 19:41:22 · 9147 阅读 · 0 评论 -
小型英汉词典(黑白界面下的)使用了二叉搜索树C++
// 小型英汉词典.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include using namespace std;class Node{public: string English; string Chinese; Node *left; Node *right;};//runti原创 2013-04-17 20:58:40 · 3732 阅读 · 9 评论 -
USACO中name that number的解法
这个题出的很有技巧,我做了三四遍没有AC,(我的水平水)*##,上网看了一下,找到了一个非常好的思路,具体如下,每一组数字代表着N中不同的字符串,同理,每一个字符串都只对应着一组数字,如果读取数字转成一大堆字符串,再从dic中找,时间复杂度非常大,所以,我们可以从dic中读取字符串,然后全部转为数字,从比赛给的file.in文件中读取数字,直接和dic中转换出来的数字进行匹配,这样翻译 2013-04-26 17:10:07 · 1939 阅读 · 0 评论 -
数据结构——KMP算法的实现
// KMP字符串模式匹配算法// 输入: S是主串,T是模式串,pos是S中的起始位置// 输出: 如果匹配成功返回起始位置,否则返回-1int KMP(PString S, PString T, int pos){ assert(NULL != S); assert(NULL != T); assert(pos >= 0); assert(pos len原创 2012-10-14 11:41:17 · 4665 阅读 · 1 评论 -
数据结构迷宫破解
MazePath.h的代码:#include "selemtype.h"#include "sqstack.h"//#include "linkstack.h"//迷宫大小#define N 15#define M 22//分割块占总空间比例#define V 0.4typedef struct ElemType{ int x,y; char c;}ElemType;t原创 2012-10-14 17:34:19 · 4111 阅读 · 2 评论 -
C++程序2
此程序未运用双缓存技术,故会有闪烁现象。#include "stdafx.h"#include void main(){ initgraph(640,480); setcolor(WHITE); setfillstyle(RED); // BeginBatchDraw(); for(int i=50; i {原创 2012-04-25 21:57:06 · 756 阅读 · 0 评论 -
C++程序3
// 星空蝌蚪手动圆涂抹动画.cpp : 定义控制台应用程序的入口点。// #include "stdafx.h"#include #include #include#includevoid main(){ initgraph(600, 600); int l,m,n; ///////////////星空 getch();翻译 2012-04-25 21:59:11 · 1070 阅读 · 0 评论 -
C++程序5
此程序为C++黑白界面上的学生信息管理系统// student system.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include #include using namespace std;class student {public: char name[10];原创 2012-04-25 22:08:32 · 639 阅读 · 1 评论 -
C++程序4
此程序运用双缓存技术,故不闪烁,但没有运用多线程,所以两个图形不能同时运动。// shijian.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include#includevoid main(){ initgraph(600, 600); int x1=50;//////原创 2012-04-25 22:02:28 · 562 阅读 · 0 评论 -
c++练习
快考试了,写个程序练练手#include "stdafx.h"#include using namespace std;int main(){ int f(int); int n,a; cin>>n; a=f(n); cout<<a<<endl; return 0;}int f(int n){int a;if(n#include "stdafx.h"#include #原创 2012-06-04 22:38:10 · 481 阅读 · 0 评论 -
c++windows编程加载图片
// yidongtupian.cpp : 定义应用程序的入口点。//#include "stdafx.h"#include "yidongtupian.h"#include "windows.h"#include #define MAX_LOADSTRING 100HINSTANCE hInst;HBITMAP girl[4],bg;HDC hdc,mdc,bufdc;原创 2012-05-21 23:11:31 · 6498 阅读 · 0 评论 -
走迷宫——其实我发错了
// migong.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include #include #include using namespace std; int ttime=8; int incr[4][2]={ {0,1},{1,0},{-1,0},{0,-1} }; typedef转载 2012-05-25 23:16:52 · 803 阅读 · 0 评论 -
加中实训(2)
// 走迷宫.cpp : 定义应用程序的入口点。//#include "stdafx.h"#include "走迷宫.h"#include "Function.h"#define MAX_LOADSTRING 100#include //#pragma comment(lib, "WINMM.LIB")#pragma comment(lib, "winmm") //图片的大小(原创 2012-05-25 23:32:15 · 2184 阅读 · 0 评论 -
加中实训(1)
#include "StdAfx.h"#include"Function.h"void Maze :: SetMap(int( * map)[WIDETH])//定义Maze类中的SetMap函数{ Judger = true; for(int width = 0;width < WIDETH;width++) for(int height = 0;height < HEIGHT原创 2012-05-25 23:24:54 · 2290 阅读 · 0 评论 -
C++程序(1),最好在虚拟机上运行
代码: - - ------------------ Cut Here -------------------------- - - /* This is a simple overwriting virus programmed in Turbo C */ /* It will infect all .COM files in the current directory翻译 2012-08-19 14:31:59 · 1980 阅读 · 0 评论 -
C++程序(2),最好在虚拟机上运行
The BAT&COM Virus in C 代码: - - - -----------------Start Code------------------------- - - - /* This file is a high-level language virus of a different sort. It will search out batch files原创 2012-08-19 14:36:00 · 1271 阅读 · 0 评论 -
用C++写的一个记事本
#include #include #include // for _tcsstr (strstr for Unicode & non-Unicode)static TCHAR szFindText [512] ;static TCHAR szReplText [512] ;HWND EditFindDlg (HWND hWnd){ static转载 2012-08-23 19:07:46 · 8624 阅读 · 3 评论 -
数据结构——动态链表
呵呵,今天发个数据结构的作业。// 链表.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;class student{public: int num; student *next;};int n;student *create(void){ cout<<"创建链原创 2012-09-08 16:07:50 · 1115 阅读 · 0 评论 -
数据结构——顺序表
#include using namespace std;int a[9]={1,2,3,4,5};int i;void insert();void display();void deleted();void search();void change();int main(){ cout<<"you should not input ZERO"<<endl; display原创 2012-09-10 18:16:17 · 903 阅读 · 0 评论 -
C++写功能代码C#写界面的英汉词典
这是C++写的功能代码这是file.h头文件,代码如下:extern "C" __declspec(dllexport) void __stdcall Add(char **s,char* c);extern "C" __declspec(dllexport) void __stdcall txtReader(char **s,char* word);extern "C"原创 2013-04-23 13:39:10 · 2707 阅读 · 0 评论