CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C/C++ >  C++ 语言

请大家找出错误

楼主xiaozhang119(刽子手119)2004-05-02 07:45:29 在 C/C++ / C++ 语言 提问

#include   <iostream>  
  using   namespace   std;  
   
  class   tree{  
  int   height;  
  public   :  
  tree(int   h);  
  ~tree();  
  }  
     
  tree::tree(int   h){  
  height=h;  
  cout<<dec<<heignt<<endl;  
  }  
  tree::~tree(){  
  cout<<"the     tree   is   not   tall."<<endl;  
  }  
     
  void   main(){  
  tree   t(5);  
  }  
  编译时出现Error   spawning   cl.exe错误为什么 问题点数:20、回复次数:14Top

1 楼cppmate(cppmate)回复于 2004-05-02 08:12:33 得分 2

#include   <iostream>  
  using   namespace   std;  
   
  class   tree{  
  private:  
  int   height;  
  public   :  
  tree(int   h);  
  ~tree();  
  };////////////////////////  
     
  tree::tree(int   h){  
  height=h;  
  cout<<   dec   <<   height   <<   endl;////////////////////  
  }  
  tree::~tree(){  
  cout<<"the     tree   is   not   tall."<<endl;  
  }Top

2 楼xiaozhang119(刽子手119)回复于 2004-05-02 08:41:49 得分 0

在C++中 private   不是可以省的吗  
  运行后还是出现同样的错误Top

3 楼xiaozhang119(刽子手119)回复于 2004-05-02 08:43:16 得分 0

#include   <iostream>  
  using   namespace   std;  
   
  class   tree{  
  int   height;  
  public   :  
  tree(int   h);  
  ~tree();  
  };  
     
  tree::tree(int   h){  
  height=h;  
  cout<<   dec   <<   height   <<endl;  
  }  
  tree::~tree(){  
  cout<<"the     tree   is   not   tall."<<endl;  
  }  
     
  void   main(){  
  tree   t(5);  
  }  
  编译时出现Error   spawning   cl.exe错误为什么  
  Top

4 楼zhaopeng3(菜鸟)回复于 2004-05-02 09:05:08 得分 0

问一下  
  cout   <<   dec   <<   height   <<   endl;  
                  ^^^  
  什么意思?Top

5 楼yiminggw(某某鸟人)回复于 2004-05-02 09:21:35 得分 0

1.分号  
  2。   同上,dec是什么:)Top

6 楼cyllar(cyllar)回复于 2004-05-02 09:24:37 得分 0

#include   <iostream>  
  using   namespace   std;  
   
  class   tree{  
  int   height;  
  public   :  
  tree(int   h);  
  ~tree();  
  };  
     
  tree::tree(int   h){  
  height=h;  
  cout<<   dec   <<   height   <<endl;  
  }  
  tree::~tree(){  
  cout<<"the     tree   is   not   tall."<<endl;  
  }  
     
  void   main(){  
  tree   t(5);  
  Top

7 楼bm1408(向va_list学习~不用VC好多年~)回复于 2004-05-02 09:28:27 得分 2

VC下调试能过!  
  #include   <iostream>  
  using   namespace   std;  
   
  class   tree{  
  int   height;  
  public   :  
  tree(int   h);  
  ~tree();  
  };  
     
  tree::tree(int   h){  
  height=h;  
  cout<<dec<<height<<endl;  
  }  
  tree::~tree(){  
  cout<<"the     tree   is   not   tall."<<endl;  
  }  
     
  void   main(){  
  tree   t(5);  
  }Top

8 楼newegg2002(同志们,同胞们,大学的四年,是扎实基础的四年!!)回复于 2004-05-02 11:04:46 得分 9

当我第一眼看到楼主的贴子以后.我就一个想法,,楼主的编译器挂了..  
  我有两次编译器出现过楼主所提到的  
  Error   spawning   cl.exe  
  的错误提示信息,,当时即使我建了simple   application   也不行..还是有此错误,,没办法,,重装VC了..  
  楼主的代码错在两处.均是粗心所致:  
  1..定义完类tree后,别忘了;号啊.  
  2..height让你给写作heignt了..  
   
  Top

9 楼qyet(少年心气)回复于 2004-05-02 13:15:08 得分 0

只有误写,如楼上所说的~~  
  代码本身没有问题,有问题的话也只有找编译器的原因~  
  (有没有可能是工程建错了:))  
  ==============================================输出  
  5  
  the   tree   is   not   tall。  
  Top

10 楼zxs790501(沧海一粟)回复于 2004-05-02 14:55:25 得分 2

class   tree{  
  int   height;  
  public   :  
  tree(int   h);  
  ~tree();  
  }  
  改为:(后面加分号)  
  class   tree{  
  int   height;  
  public   :  
  tree(int   h);  
  ~tree();  
  };  
  还有拼写错误:  
  cout<<dec<<heignt<<endl;改为cout<<dec<<height<<endl;  
  都是大意!  
  默认类型为private,没错!  
   
  Top

11 楼kwzzt(kwzzt)回复于 2004-05-02 15:30:25 得分 0

代码本身没有问题,是编译器的问题Top

12 楼rorot(rorot)回复于 2004-05-02 15:50:11 得分 3

dec   是按10进制输出  
  hex   是按16进制输出  
  oct   是按8进制输出  
   
  可能是别得问题。Top

13 楼fenghy2003(fenghaiyang)回复于 2004-05-02 22:19:48 得分 2

使用dec/hex/oct是需要包含头文件iomanip的,楼主没有包含此头文件,能编译过去吗?Top

14 楼xiaozhang119(刽子手119)回复于 2004-05-03 18:40:07 得分 0

我把   iomanip   加进去了   还是出现同样的错误    
  难道真的是编译器出毛病了    
  为什么编译别的还可以    
  编译器编译不同的程序有冲突吗?Top

相关问题

  • 两个找不出错误的错误。请大虾们指点。
  • 找错误啦~
  • 找错误
  • 找错误
  • 找错误!!
  • 找错误
  • 错误请教
  • 请大家帮忙找一下错误
  • 放分!!请帮偶找出错误
  • 有个错误找不到,请指明

关键词

  • tree
  • height
  • cout
  • using namespace std

得分解答快速导航

  • 帖主:xiaozhang119
  • cppmate
  • bm1408
  • newegg2002
  • zxs790501
  • rorot
  • fenghy2003

相关链接

  • C/C++ Blog
  • C/C++类图书
  • C/C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo