Я использую 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_ *= scaleFactor;
height_ *= scaleFactor;
}
private:
double width_{};
double height_{};
};
void printInfo(const Rectangle & r) {
cout << "Width" <<r.Width() << '\n';
cout << "Height" << r.Height() << '\n';
cout << "Area" << r.Area() << '\n';
cout << "Per" << r.Perimeter() << '\n';
}
int main() {
setlocale(LC_ALL, "pl_PL.UTF8");
Rectangle rect;
}