#include<stdio.h>
int s;
template <class type>
type dahong(type array)
{
for(int i=0;i<array;i++)
{
for(int j=0;j<array-i;j++)
{
if (array[j])>array[j+1])
{
s=array[j];
array[j]=array[j+1];
array[j+1]=s;
}
}
}
}
void main(int argc,char* arfv[])
{
int a[6]={2,1,3,4,6,5};
int as=dahong(a);
for(int i=0;i<6;i++)
{
printf("%4d",a[i]);
}
}
这里错了:error C2440: 'initializing' : cannot convert from 'int *' to 'int'
int s;
template <class type>
type dahong(type array)
{
for(int i=0;i<array;i++)
{
for(int j=0;j<array-i;j++)
{
if (array[j])>array[j+1])
{
s=array[j];
array[j]=array[j+1];
array[j+1]=s;
}
}
}
}
void main(int argc,char* arfv[])
{
int a[6]={2,1,3,4,6,5};
int as=dahong(a);
for(int i=0;i<6;i++)
{
printf("%4d",a[i]);
}
}
这里错了:error C2440: 'initializing' : cannot convert from 'int *' to 'int'