level 4
橘安nn
楼主
#include <iostream>
using namespace std;
class Rectangle {
public:
void setLength() {
cin>> length;
}
void setWidth() {
cin>> width;
}
void Area() {
cin >> length >> width;
s = length * width;
cout << s << endl;
}
private:
int length;
int width;
int s;
};
int main() {
int length, width;
cin >> length >> width;
Rectangle rect;
rect.setLength(length);
rect.setWidth(width);
cout << rect.returnArea() << endl;
}
2022年10月12日 09点10分
1
using namespace std;
class Rectangle {
public:
void setLength() {
cin>> length;
}
void setWidth() {
cin>> width;
}
void Area() {
cin >> length >> width;
s = length * width;
cout << s << endl;
}
private:
int length;
int width;
int s;
};
int main() {
int length, width;
cin >> length >> width;
Rectangle rect;
rect.setLength(length);
rect.setWidth(width);
cout << rect.returnArea() << endl;
}