Cannot open include file: 'head.h': No such file or directory
#include <head.h>#include <malloc.h>
typedef int ElemType;
typedef ElemType *Triplet;
Status InitTriplet(Triplet *t,ElemType v1,ElemType v2,ElemType v3){
/*构造三元组T,依次置T的三个元素初值为v1,v2,v3*/
(*t)=(ElemType *)malloc(3 *sizeof(ElemType));
if(!t) exit(OVERFLOW);
(*t)[0]=v1;(*t)[1]=v2;(*t)[2]=v3;
return OK;
}
Status DestroyTriplet(Triplet *t){
/*销毁三元组T*/
free(*t);
*t=NULL;
return OK;
}
Status Get(Triplet T,int i,ElemType *e){
/*1<=i<=3,用e返回T的第i元的值*/
if(i<1||i>3) return ERROR;
*e=T[i-1];
return OK;
}
Status Put(Triplet *t,int i,ElemType e){
/*1<=i<=3,置T的第i元的值为e*/
if(i<1||i>3) return ERROR;
(*t)[i-1]=e;
return OK;
}
Status IsAscending(Triplet T){
/*如果T的三个元素按升序排列,则返回1,否则返回0*/
return (T[0]<=T[1])&&(T[1]<=T[2]);
}
Status IsDescending(Triplet T){
/*如果T的三个元素按降序排列,则返回1,否则返回0*/
return (T[0]>=T[1])&&(T[1]>=T[2]);
}
Status Max(Triplet T,ElemType *e){
/*用e返回T的最大元素的值*/
*e=(T[0]>=T[1])?((T[0]>=T[2])?T[0]:T[2]):((T[1]>=T[2])?T[1]:T[2]);
return OK;
}
Status Min(Triplet T,ElemType *e){
/*用e返回T的最小元素的值*/
*e=(T[0]<=T[1])?((T[0]<=T[2])?T[0]:T[2]):((T[1]<=T[2])?T[1]:T[2]);
return OK;
}
void Print(Triplet T){
/*打印三元组T的各个元素值*/
int i;
ElemType elem,*p=&elem;
for(i=1;i<=3;i++)
{Get(T,i,p);
printf("No.%d=%d\n",i,elem);
}
}
main()
{
Triplet T,*t=&T;
ElemType e1,e2,e3,elem,*p=&elem;
int i;
printf("\nPlease input 3 numbers:\n");
scanf("%d%d%d",&e1,&e2,&e3);
InitTriplet(t,e1,e2,e3);
Print(T);/*初始化三元组T并打印*/
if(IsAscending(T)) printf("Triplet is IsAscending!\n");
else if(IsDescending(T)) printf("Triplet is IsDescending!\n");
else printf("Triplet is not sequence!\n");/*判断三元组是否有序*/
Max(T,p);
printf("the max num is %d\n",elem);/*输出最大值*/
Min(T,p);
printf("the min num is %d\n",elem);/*输出最小值*/
ll:printf("Please input which one do you want to change:(1-3)");
scanf("%d",&i);/*输入要改的元素位序*/
if(i>=1&&i<=3)
{printf("Please input a new number:");
scanf("%d",&elem);
Put(t,i,elem);
Print(T);
}/*修改对应的值*/
else {printf("Your input not correct!");/*若不合法,则重新输入要改的元素位序直至合法为止*/
goto ll;}
DestroyTriplet(t);
}.
提示错误Cannot open include file: 'head.h': No such file or directory,怎么解决啊?