爱问知识人 爱问教育 医院库

一个C 小程序老调不好

首页

一个C++小程序老调不好


        

提交回答
好评回答
  • 2008-11-06 23:32:00
      改了一下,错误的地方标出来了,你对比一下就知道了 #include<iostream> #include<cmath> using namespace std; class Right_Angled_Triangle //声明类 { private: //以下为私有部分 float right_a; float right_b; float hypotenuse; public: //以下为公有部分 void set_rights() { cout<<"input right_a and right_b:"; cin>>right_a; cin>>right_b; } void out_hypotenuse() //定义公共函数out_hypotenuse() { hypotenuse=sqrt(right_a* right_a+right_b* right_b); cout<<"hypotenuse="<<hypotenuse<<endl; } //你的这地方多了个分号 }; int main()//你的缺了这一行。
       {//这个左大括号是从下面提上来的。当然,下面的两个变量也可以定义到main()前面。 Right_Angled_Triangle triangle1,triangle2; //定义Right_Angled_Triangle的两个变量int main() triangle1。
      set_rights(); triangle2。out_hypotenuse(); return 0; }。

    刘***

    2008-11-06 23:32:00

其他答案

类似问题

换一换

相关推荐

正在加载...
最新资料 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):