qfedu-cpp-level/day2/homework/h3.cpp

22 lines
358 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 1. 2. 创建一个名为 Rectangle 的类,具有成员变量 width 和 height以及成员函数 double calculateArea() ,用于计算矩形的面积。
#include <iostream>
using namespace std;
class Rectangle
{
public:
double calculateArea()
{
return width * height;
}
int width, height;
};
int main()
{
return 0;
}