我使用的是 Visual Studio 2019,当我用 C++ 编写第一堂课时,发生了错误。当我删除它时它消失了#include <Windows.h>。我的问题是,为什么Windows.h会与 C++ 类发生冲突,是否可以同时使用两者(我几乎可以肯定)。
#include <iostream>
#include <locale>
using std::cout;
using std::cin;
class Rectangle {
public:
Rectangle() = default;
Rectangle(double width, double height)
: width_{ width }, height_{ height }
{}
double Width() const { return width_; }
double Height() const { return height_; }
double Area() const {
return width_ * height_;
}
double Perimeter() const {
return 2 * (width_ + height_);
}
void Scale(double scaleFactor) {
width_ *= …Run Code Online (Sandbox Code Playgroud)