国产探花免费观看_亚洲丰满少妇自慰呻吟_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;}

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


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

圖片精選

主站蜘蛛池模板: 安庆市| 个旧市| 西宁市| 南宁市| 越西县| 大关县| 神池县| 丹阳市| 吴堡县| 茌平县| 资中县| 甘肃省| 綦江县| 潜江市| 双牌县| 郴州市| 五河县| 望奎县| 抚远县| 政和县| 上高县| 昌吉市| 遂平县| 双鸭山市| 普洱| 淮南市| 弋阳县| 闽清县| 井冈山市| 横山县| 博客| 沧源| 甘谷县| 伊宁县| 徐闻县| 涿州市| 利川市| 玉林市| 封开县| 绥宁县| 巨野县|