![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++初学(郑莉版)
qq_50458376
好好学习
展开
-
4-11
#include<iostream>using namespace std;class Retangle {public: Retangle() { length = 0; width = 0; } void caculateRetangleArea(float newL, float newW); private: float length, width;};void Retangle::caculateRetangleArea(float newL, fl.原创 2020-11-07 23:35:32 · 73 阅读 · 0 评论 -
例3-1 编写一个x的n次方的函数
例3-1编写一个x的n次方的函数#include<iostream>using namespace std;double power(double x, int n) { double val = 1; while (n--) val *= x; return val;}int main() { cout << "5 to power 2 is " << power(5, 2) << endl; return 0;}...原创 2020-10-18 16:23:21 · 493 阅读 · 0 评论