大学看看这是为什么?

来源:百度知道 编辑:UC知道 时间:2024/05/15 00:20:52
这个代码在c++6.0,中出错显示:( fatal error C1083: Cannot open include file: 'alloc.h': No such file or directory)
但是把#include "alloc.h"去掉就可以正确运行了,可是alloc是malloc的头文件呀?
读入9个字符到一个存储模块中,然后复制到另一存储块中,并反顺序输出。
#include "stdio.h"
#include "alloc.h" //就是这句
#define LIMIT 9
#define ERROR { printf("out of meony\n");return;}
void main()
{
char *p,*q,*aux;
p=(char *)malloc(LIMIT);
if(p==NULL)
ERROR;
for(aux=p;aux<p+LIMIT;*aux=getchar(),aux++)
;
printf("\n");
q=(char *)malloc(LIMIT);
if(q==NULL)
ERROR;
for(aux=q;aux<q+LIMIT;*aux++=*p++)
;
p=p-LIMIT;
for(aux--;aux>=q;aux--)
putchar(*aux);
putchar('\n');
free(p);
free(q);
}

头文件alloc.h和malloc.h的作用和内容基本相同,但前者供Borland C++编译程序使用,后者供Microsoft C++编译程序使用。

意思是找不到这个头文件,你看下VC的设置里面的"目录"里面的那些目录有没有这个文件.