关于C++的一个测试程序,本菜鸟求大家帮忙

[复制链接]
查看11 | 回复2 | 2009-6-11 14:52:27 | 显示全部楼层 |阅读模式
#include
typedef int KeyType;
typedef struct
{

KeyType key;
}DataTape;
void InsertSort(DataType a[],int n)
{
int i,j;
DataType temp;
for(i = 0; i-1 && temp.key < a[j].key)
{
a[j+1] = a[j];
j--;
}
a[j+1] = temp;
}
}
void main(void)
{
DataType test[6] = {64,5,7,89,6,24};
int i,n = 6;
InsertSort(test,n);
for(i=0; i<n; i++)
printf("%d ",test.key);
}
编译室提示这个程序的
void InsertSort(DataType a[],int n)
变量列表语法错误,我自学C++,没什么基础,请教大家,这到底是怎么一回事,还有,希望能给我一些学C的建议,在此谢过。

回复

使用道具 举报

千问 | 2009-6-11 14:52:27 | 显示全部楼层
typedef struct{
KeyType key;}DataTape;void InsertSort(DataType a[],int n)你前面定义的是结构体变量DataTape, 后面却是DataType。。。。...
回复

使用道具 举报

千问 | 2009-6-11 14:52:27 | 显示全部楼层
多玩“大家来找茬”,可减少此类错误...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行