C语言:冒泡排序,二分查找,模板声明

#include "stdafx.h"
#include 
void Sort (int* a,int length)
{
    int temp;
    for(int j=0; ja[i+1])
            {
                temp=a[i];
                a[i]=a[i+1];
                a[i+1]=temp;
            }
        }
    }
    return;
}
void Print(int* a,int length)
{
    for(int i=0;ia[index])
        {
            begin=index+1;
        }
        else
        {
            return index;
        }
    }
}
int main(int argc, char* argv[])
{
    int a[5]={2,5,1,4,9};
    Sort(a,5);
    Print(a,5);
    int index=find(a,5,4);
    printf("index=%d\n",index);
    system("pause");
    printf("Hello World!\n");
    return 0;
}
image.png
#include "stdafx.h"
#include 
template
void sort(T a,int length)
{
    int temp;
    for(int i=0;ia[i+1])
            {
                temp=a[i];
                a[i]=a[i+1];
                a[i+1]=temp;
            }
        }
    }
}
template
void print(T1 a[],int length)
{
    for(int i=0;i

你可能感兴趣的:(C语言:冒泡排序,二分查找,模板声明)