我用vc6.0编译一个工程时报错是下面情况:
D:\MyProjects\lc1\main.cpp(22) : error C2065: 'program' : undeclared identifier
Error executing cl.exe.
但是我的函数实现文件中定义声明了program这一函数,请问是什么原因啊?
D:\MyProjects\lc1\main.cpp(22) : error C2065: 'program' : undeclared identifier
Error executing cl.exe.
但是我的函数实现文件中定义声明了program这一函数,请问是什么原因啊?
解决方案 »
- 新人请问如何在VC中,启动另一个程序。
- 关于重绘的Menu在CXXXView里响应pop菜单,菜单项状态不更新
- 请教ACCESS高手:我想用脚本删除一个表的约束关系,该怎么删除。ALTER TABLE CONTRACTRECEIPT DROP CONSTRAINT "关系名"
- Win2000 SERVER的程序能开多少个线程?
- 如何灰掉CDialog右上角的"X"按钮
- 关于MODEM的控制,高手帮忙!!急急!难啊难
- ListView单文档界面的问题求救
- 新一代网络动画软件出来了,全面代替 flash 请看 www.svgcn.com
- 急~~~~~~~~·····如何在activex中控制IE页面不允许打印?·····进门就有分!~
- 各位,为什么用BITMAPINFO和Bitmap::FromBITMAPINFO创建的32位位图无法半透明?
- 为何设置的鼠标图标自动改变
- Charles Petzold的Windows程序设计中译本如何?
曾经俺用VC2005的时候,就是要打个补丁就避免类似的错误。
但是VC6.0貌似没有此类BUG,所以还是上下代码
#define SEQLIST_H
template<class Type>class Seqlist
{
private:
Type*elem;
int length;
int listsize;
public:
Seqlist(int size);
~Seqlist(void){delete[]elem;}
int SeqListLength(void)const{
return length;
}
int SeqListInsert(int i,Type&e);
Type&SeqGetElem(int i)const{
return elem[i-1];
}
int SeqLocateElem(Type e);
int ReplaceElem(int i,Type&e);
};
#endif
。
#include "seqlist.h"
template <class Type>
void merge(Seqlist<Type>&la,Seqlist<Type>&lb,Seqlist<Type>&lc)
{
Type data;int i;
int la_length=la.SeqListLength();
int lb_length=lb.SeqListLength();
for(i=1;i<la_length;i++)
{
data=la.SeqGetElem(i);
lc.SeqListInsert(i,data);
}
int lc_length=lc.SeqListLength();
for(i=1;i<=lb_length;i++)
{
data=lb.SeqGetElem(i);
if(!lc.SeqLocateElem(data))lc.SeqListInsert(++lc_length,data);
}}
template<class Type>void Bubblesort(Seqlist<Type>&lc)
{
Type temp;
int flag=1;
int n=lc.SeqListLength();
for(int i=1;i<n&&flag==1;i++)
{
flag=0;
for(int j=1;j<=n-i;j++)
{
if(lc.SeqGetElem(j)>lc.SeqgetElem(j+1))
{
temp=lc.SeqGetElem(j);
lc.REplaceElem(j,lc.SeqGetElem(j+1));
lc.ReplaceElem(j+1,temp);
flag=1;}
}}
}
template<class Type>
void program(Seqlist<Type>&la,Seqlist<Type>&lb,Seqlist<Type>&lc)
{
merge(la,lb,lc);
Bubblesort(lc);
}
。
#include <iostream.h>
#include "seqlist.h"
#include <stdlib.h>
void main()
{
Seqlist<int>la(10),lb(10),lc(10);
cout<<"分别输入集合A与集合B的元素个数\n";
int na,nb,data;
cin>>na>>nb;
cout<<"输入集合A的元素\n";
for(int i=1;i<=na;i++)
{
cin>>data;
la.SeqListInsert(i,data);
}
cout<<"输入集合B的元素\n";
for(int j=1;j<=nb;j++)
{
cin>>data;
lb.SeqListInsert(j,data);
}
program(la,lb,lc);
cout<<"输出计算结果是\n";
int nc=lc.SeqListLength();
for(i=1;i<=nc;i++){
cout<<lc.SeqGetElem(i)<<" ";
}
}
void merge(Seqlist<Type>&la,Seqlist<Type>&lb,Seqlist<Type>&lc)
{
Type data;int i;
int la_length=la.SeqListLength();
int lb_length=lb.SeqListLength();
for(i=1;i<la_length;i++)
{
data=la.SeqGetElem(i);
lc.SeqListInsert(i,data);
}
int lc_length=lc.SeqListLength();
for(i=1;i<=lb_length;i++)
{
data=lb.SeqGetElem(i);
if(!lc.SeqLocateElem(data))lc.SeqListInsert(++lc_length,data);
}}
template<class Type>void Bubblesort(Seqlist<Type>&lc)
{
Type temp;
int flag=1;
int n=lc.SeqListLength();
for(int i=1;i<n&&flag==1;i++)
{
flag=0;
for(int j=1;j<=n-i;j++)
{
if(lc.SeqGetElem(j)>lc.SeqgetElem(j+1))
{
temp=lc.SeqGetElem(j);
lc.REplaceElem(j,lc.SeqGetElem(j+1));
lc.ReplaceElem(j+1,temp);
flag=1;}
}}
}
template<class Type>
void program(Seqlist<Type>&la,Seqlist<Type>&lb,Seqlist<Type>&lc)
{
merge(la,lb,lc);
Bubblesort(lc);
}
这些,但还是不行。。