博文

Microsoft.Visual.Studio.2005.Professiona(2006-05-25 16:41:00)

摘要: 软件名称: Microsoft.Visual.Studio.2005.Professional.Edition.DVD-ZWTiSO.part1 Microsoft.Visual.Studio.2005.专业版.part1 软件语言: 英文版 软件类型: 编程相关 运行环境: Win2000 WinXP   http://soft.freestu.net/SoftView.php?id=450909693351 1张dvd分四块下载 挺快的  ......

阅读全文(2382) | 评论:0

练习:选择排序(2006-05-16 23:46:00)

摘要://对数组进行选择排序/*选择排序的过程为:在桌上的牌中找出最小的一张牌,拿在手中;重复这种操作,直到把所有牌都拿在手中。*/#include <iostream.h>int *SeleSort(int a[],int n){    int *b=new int(n);//    b[0]=a[0];    int t=a[0];    for(int i=0;i<n;i++)    {        t=a[i];        for(int j=i;j<n;j++)        {            if(t>a[j])            {int k;  k=a[j];  a[j]=t;  t=k;}        }        b[i]=t;    }    return b;}void main(){    int a[]={9,8,10,6,5,4,3,2,1,0,0,0,0,0,......

阅读全文(2351) | 评论:0

练习:插入排序(2006-05-16 23:45:00)

摘要:/*数组的插入排序从一堆牌的上面开始拿牌,每次拿一张牌,按排序原则把牌放到手中正确的位置。桌上的牌拿完后,手中的牌也就排好序了*///对数组的前N个元素进行插入(有小到大)排序#include <iostream.h>int *InsertionSort(int a[],int n){    int *b;    b=new int(n);    b[0]=a[0];    for(int i=1;i<n;i++)    {        for(int j=i-1;j>=0;j--)        {            if(a[i]<b[j])                b[j+1]=b[j];            else            {                b[j+1]=a[i];break;         &......

阅读全文(2315) | 评论:0

练习:交换排序(2006-05-16 23:41:00)

摘要://对数组进行交换排序/*交换排序的过程为:    (1)先拿两张牌放到手中。如果左边的牌要排在右边的牌的后面,就交换这两张牌的位置。    (2)然后拿下一张牌,并比较最右边两张牌,如果有必要就交换这两张牌的位置。    (3)重复第(2)步,直到把所有的牌都拿到手中。    (4)如果不再需要交换手中任何两张牌的位置,就说明牌已经排好序了;    否则,把手中的牌放到桌上,重复(1)至(4)步,直到手中的牌排好序。*/#include <iostream.h>int *ExchSort(int a[],int n){    int count=1;    while(count!=0)    {        count=0;        for(int i=0;i<n;i++)        {            int t;            if(a[i]>a[i+1])            {             &......

阅读全文(2394) | 评论:0

练习:用栈实现逆序输出26个字母(2006-05-13 12:10:00)

摘要://实现栈类//逆序输出26个字母//2006 05 13#include <iostream.h>#include<string>class Node{public:    char data;    Node *next;};class Stack:public Node{    Node *Bottom;    Node *Top;    int SLen;public:    void InitStack();    char Pop();    void Push(char e);    bool StackEmpty();};void Stack::InitStack(){    Top=new Node;    Bottom=Top;    SLen=0;}char Stack::Pop(){    char e;    Node *p;    if(!(Top->next))        exit(0);    else    {        p=Top;  &nbs......

阅读全文(2811) | 评论:0

练习:用栈检测表达式括弧匹配(2006-05-13 12:02:00)

摘要:/1、实现栈类//2、检测表达式括弧匹配//2006 05 13#include <iostream.h>#include<string>class Node{public:    int data;    Node *next;};class Stack:public Node{    Node *Bottom;    Node *Top;    int SLen;public:    void InitStack();    char Pop();    void Push(int e);    bool StackEmpty();};void Stack::InitStack(){    Top=new Node;    Bottom=Top;    SLen=0;}char Stack::Pop(){    char e;    Node *p;    if(!(Top->next))        exit(0);    else    {        p=Top;  &nb......

阅读全文(2467) | 评论:0

练习:用栈实现10进制到8进制的转换(2006-05-13 11:59:00)

摘要://1、实现栈类//2、实现10进制到8进制的转换//2006 05 13#include <iostream.h>#include<string>class Node{public:    int data;    Node *next;};class Stack:public Node{    Node *Bottom;    Node *Top;    int SLen;public:    void InitStack();    int Pop();    void Push(int e);    bool StackEmpty();};void Stack::InitStack(){    Top=new Node;    Bottom=Top;    SLen=0;}int Stack::Pop(){    int e;    Node *p;    if(!(Top->next))        exit(0);    else    {        p=Top;  &......

阅读全文(2952) | 评论:0

练习:冒泡排序(2006-05-08 00:19:00)

摘要:////冒泡排序//作者:ZYQ//vc6.0通过//目的:算法试验#include <iostream.h>void bubble(int a[],int n){    int temp;    for(int i=n-1,change=1;i>=1&&change;--i)    {        change=0;        for(int j=0;j<i;++j)            if(a[j]>a[j+1])            {                temp=a[j];                a[j]=a[j+1];                a[j+1]=temp;                change=1;    &n......

阅读全文(2758) | 评论:0

练习:KMP算法 字符串匹配(2006-05-08 00:16:00)

摘要:////字符串模式匹配:KMP算法////06.05.07 vc6.0调试通过//ZYQ//#include <iostream.h>#include <string>int* get_next(char *T);void main(){    char* s="hhhsauhduwdh";    char* t="hdu";    int i=0;    int j=0;    int S=strlen(s);    int T=strlen(t);    int *next=get_next(t);    while(i<S&&j<T)    {//判定条件i<S&&j<T说明:字符串数组下标从0开始,到字符串长度减1结束        if(j==0||s[i]==t[j])        {i++;j++;}//继续向后比较字符        else            j=next[j];//模式串向后移动    }    if(j>=T)      &nb......

阅读全文(5067) | 评论:3

练习:字符串首尾模式匹配(2006-05-06 20:50:00)

摘要://字符串首尾模式匹配#include <iostream.h>#include <string>void main(){    char* s="hhhsauhduwdh";    char* t="sau";    int i=0;    int j=0;    int Slen=strlen(s);    int Tlen=strlen(t);    while(i<=Slen-Tlen+1)    {//        if(s[i]!=t[0]){i++;}        else if(s[i]==t[0]&&s[i+Tlen-1]!=t[Tlen-1]){i++;}        else         {            int k=1;            j=1;            while(j<Tlen&&s[i+k]==t......

阅读全文(2931) | 评论:0