| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 7754 人关注过本帖
标题:fatal error C1083: Cannot open include file: 'stdafx.h': No such file ...
只看楼主 加入收藏
koujia
Rank: 1
等 级:新手上路
帖 子:12
专家分:4
注 册:2013-10-22
结帖率:80%
收藏
已结贴  问题点数:10 回复次数:6 
fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directo
头文件用了#include<stdafx.h>就产生这样的错误,不用就产生一大堆不知道怎么回事的错误,怎么解决啊,百度过了,可是还是没解决
搜索更多相关主题的帖子: include file 
2013-10-29 18:29
韶志
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:斗气大陆
等 级:贵宾
威 望:44
帖 子:2223
专家分:13592
注 册:2013-3-22
收藏
得分:0 
stdafx.h不是C或C++里的标准头文件...   
而且一般使用默认是双引号括起来不是<>,应该是#include“stdafx.h”

三十年河东,三十年河西,莫欺少年穷!
2013-10-29 19:16
koujia
Rank: 1
等 级:新手上路
帖 子:12
专家分:4
注 册:2013-10-22
收藏
得分:0 
是我打错了,用的是双引号就是这样的错误
2013-10-29 19:22
韶志
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:斗气大陆
等 级:贵宾
威 望:44
帖 子:2223
专家分:13592
注 册:2013-3-22
收藏
得分:0 
回复 3楼 koujia
那你就把完整的程序贴上来

三十年河东,三十年河西,莫欺少年穷!
2013-10-29 19:24
koujia
Rank: 1
等 级:新手上路
帖 子:12
专家分:4
注 册:2013-10-22
收藏
得分:0 
回复 2楼 韶志
能帮忙看一下这个程序吗
#include"stdafx.h"
#include<stdio.h>
#include<malloc.h>


//这里ElemType可以是整型(Int,Long)、浮点数(Float,Double)和字符(Char)
typedef int ElemType;
typedef struct TreeNode{
ElemType data;
struct TreeNode * lchild;
struct TreeNode * rchild;
}BiTreeNode,*BiTree;
void InitBiTree(ElemType elem,BiTree& bt)
{
bt->data = elem;
bt->lchild = NULL;
bt->rchild = NULL;
}


void InsertBiTree(ElemType elem,BiTree& bt)
{
if(bt == NULL) {
bt = (BiTree)malloc(sizeof(BiTreeNode));
bt->data = elem;
bt->lchild = NULL;
bt->rchild = NULL;
}
else{
if(elem>bt->data)
{
InsertBiTree(elem,bt->lchild);
}
else{
InsertBiTree(elem,bt->rchild);
}
}
}


int HightBiTree(BiTree bt)
{
int hight_left,hight_right;
if(bt == NULL) return 0;
else{
hight_left = 1 + HightBiTree(bt->lchild);
hight_right = 1 + HightBiTree(bt->rchild);


if(hight_left>hight_right)
{
return hight_left;
}else
{
return hight_right;
}
}
}
void DisplayBiTree(BiTree bt)
{
if(bt != NULL){
printf("%d#",bt->data);
DisplayBiTree(bt->lchild);
DisplayBiTree(bt->rchild);
}
else return;
}








void AdjustBiTreeByLL(BiTree& bt)
{
BiTree lc = (BiTree)malloc(sizeof(BiTreeNode));
lc=bt->lchild;                       //lc指向B      
bt->lchild=lc->rchild;          //把B结点的右子树挂接为A的左子树
lc->rchild=bt;                      //A结点成为B的右孩子
bt=lc;                                   //p指向新的根结点
}


void AdjustBiTreeByRR(BiTree& bt)
{
BiTree lc = (BiTree)malloc(sizeof(BiTreeNode));
lc=bt->rchild;                       //lc指向B      
bt->rchild=lc->lchild;          //把B结点的右子树挂接为A的左子树
lc->lchild=bt;                      //A结点成为B的右孩子
bt=lc;                                   //p指向新的根结点
}


void AdjustBiTreeByLR(BiTree& bt)
{
BiTree b = (BiTree)malloc(sizeof(BiTreeNode));
BiTree c = (BiTree)malloc(sizeof(BiTreeNode));
b = bt->lchild;
c = bt->lchild->rchild;
bt->lchild=c->rchild;   
b->rchild=c->lchild;  
c->lchild=b;               
c->rchild=bt;            
bt = c;
}


void AdjustBiTreeByRL(BiTree& bt)
{
BiTree b = (BiTree)malloc(sizeof(BiTreeNode));
BiTree c = (BiTree)malloc(sizeof(BiTreeNode));


b = bt->rchild;
c = bt->rchild->lchild;


bt->rchild=c->lchild;   
b->lchild=c->rchild;  
c->rchild=b;               
c->lchild=bt;            
bt = c;
}




void AdjustAVLBiTree(BiTree& bt)
{
int bf,lbf,rbf;
bf = HightBiTree(bt->lchild) - HightBiTree(bt->rchild);
if(bf == NULL) return;
if(bf>=2)
{
printf("\n\n这课二叉树不平衡,正在进行调整二叉树");
lbf = HightBiTree(bt->lchild->lchild) - HightBiTree(bt->lchild->rchild);
//属于LL型变换
if(lbf>=1){
printf("\n正在进行LL型变换\n");
AdjustBiTreeByLL(bt);
DisplayBiTree(bt);
}
//属于LR型变换
else if(lbf<=-1){
printf("\n正在进行LR型变换\n");
AdjustBiTreeByLR(bt);
DisplayBiTree(bt);
}
}else if(bf<=-2)
{
printf("\n\n这课二叉树不平衡,正在进行调整二叉树");
rbf = HightBiTree(bt->rchild->lchild) - HightBiTree(bt->rchild->rchild);
//属于RL型变换
if(rbf>=1)
{
printf("\n正在进行RL型变换\n");
AdjustBiTreeByRL(bt);
DisplayBiTree(bt);
}
//属于RR型变换
else if(rbf<=-1)
{
printf("\n正在进行RR型变换\n");
AdjustBiTreeByRR(bt);
DisplayBiTree(bt);
}
}
else{
if((bt->lchild==NULL)&&(bt->rchild==NULL))
{
return;
}
else{
if(bt->lchild !=NULL){
AdjustAVLBiTree(bt->lchild);
}
if(bt->rchild !=NULL){
AdjustAVLBiTree(bt->rchild);
}
}
}
}


bool DeleteBiTree(ElemType elem,BiTree& bt)
{
bool flag,flagl,flagr;
BiTree temp = (BiTree)malloc(sizeof(BiTreeNode));
BiTree p = (BiTree)malloc(sizeof(BiTreeNode));
if(bt == NULL) return false;
else{
if(bt->data == elem)
{
if(bt->lchild!=NULL){
temp = bt->lchild;
while(temp->rchild!=NULL){
temp = temp->rchild;
}
if(temp->lchild == NULL)
{
printf("\n进行LR型删除!\n");
bt->data = temp->data;
temp = NULL;
}else{
printf("\n进行LRL型删除!\n");
bt->data = temp ->data;
p = temp->lchild;
temp->data = p->data;
temp->lchild = p->lchild;
temp->rchild = p->rchild;
}
}else {
//将bt置空
if(bt->rchild==NULL){
printf("\n进行NULL型删除!\n");
bt = NULL;
}else
{
temp = bt->rchild;
while(temp->lchild!=NULL){
temp = temp->lchild;
}
if(temp->rchild == NULL)
{
printf("\n进行RL型删除!\n");
bt->data = temp->data;
temp = NULL;
}else{
printf("\n进行RLR型删除!\n");
bt->data = temp ->data;
p = temp->rchild;
temp->data = p->data;
temp->lchild = p->lchild;
temp->rchild = p->rchild;
}
}
}
return true;
}else{
flagl = DeleteBiTree(elem,bt->lchild);
flagr = DeleteBiTree(elem,bt->rchild);
flag = flagl | flagr;
}
}
return flag;
}


void InsertAVLBiTree(ElemType elem,BiTree& bt)
{
InsertBiTree(elem,bt);
AdjustAVLBiTree(bt);
}
void DeleteAVLBiTree(ElemType elem,BiTree& bt)
{
printf("\n正在试图删除元素%d......\n",elem);
if(DeleteBiTree(elem,bt)) printf("\n删除%d成功!\n",elem);
else printf("\n删除%d失败!\n",elem);
AdjustAVLBiTree(bt);
}


void CreateAVLBiTree(ElemType arr[],BiTree& bt)
{
int i;
printf("\n初始化二叉树:\n");
printf("\n插入元素%d\n",arr[0]);
InitBiTree(arr[0],bt);
printf("\n创建二叉树:\n");
for(i=1;i<12;i++){
printf("\n插入元素%d\n",arr[i]);
InsertBiTree(arr[i],bt);
AdjustAVLBiTree(bt);
}
}


int main()
{
BiTree bt = (BiTree)malloc(sizeof(BiTreeNode));
ElemType arr[256] = {49,12,32,4,78,10,7,5,99,20,77,56};


CreateAVLBiTree(arr,bt);
printf("\n显示:\n");
DisplayBiTree(bt);


DeleteAVLBiTree(10,bt);
printf("\n显示:\n");
DisplayBiTree(bt);


DeleteAVLBiTree(10,bt);
printf("\n显示:\n");
DisplayBiTree(bt);


return 0;
 
 
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        z






[ 本帖最后由 koujia 于 2013-10-29 19:37 编辑 ]
2013-10-29 19:33
韶志
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:斗气大陆
等 级:贵宾
威 望:44
帖 子:2223
专家分:13592
注 册:2013-3-22
收藏
得分:10 
我勒个去...    好吧  我认输   找不到

三十年河东,三十年河西,莫欺少年穷!
2013-10-29 19:41
koujia
Rank: 1
等 级:新手上路
帖 子:12
专家分:4
注 册:2013-10-22
收藏
得分:0 
回复 6楼 韶志
好吧,还是谢谢了
2013-10-29 19:54
快速回复:fatal error C1083: Cannot open include file: 'stdafx.h': No such ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.037053 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved