国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C++ > 正文

C++實例---構造函數的重載

2019-11-08 18:52:28
字體:
來源:轉載
供稿:網友

運行環境:macOS shell 代碼:

#include <iostream>#include <iomanip>#include <string>using namespace std;class point{PRivate: double fx, fy;public: point(); point(double x, double y); void showpoint();};point::point(){ fx = 0.0; fy = 0.0;}point::point(double x, double y = 5.5){ fx = x; fy = y;}void point::showpoint(){ cout<<fx<<" "<<fy<<endl;}int main (){ point p1; cout<<"the fx and fy of p1 : "; p1.showpoint(); point p2(10); cout<<"the fx and fy of p2 : "; p2.showpoint(); point p3(1.1,2.0); cout<<"the fx and fy of p3 : "; p3.showpoint(); return 0;}

運行結果: 這里寫圖片描述


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 汾阳市| 红安县| 清丰县| 杨浦区| 北安市| 佛教| 资溪县| 嫩江县| 凤翔县| 德州市| 南阳市| 莒南县| 乐安县| 新和县| 安陆市| 宁武县| 台中县| 永宁县| 邳州市| 怀化市| 徐闻县| 稻城县| 寿阳县| 中江县| 长寿区| 垣曲县| 平定县| 辽宁省| 望奎县| 会东县| 商都县| 电白县| 冕宁县| 新民市| 天祝| 凤阳县| 沙坪坝区| 金沙县| 镇平县| 乐山市| 福建省|