Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Дараах бүтцүүдийг тодорхойлоорой
- 1. Point
- 2. Triangle
- 3. Square
- 4. Rectangle
- 5. Circle
- */
- #include <iostream>
- using namespace std;
- struct point {
- double x, y;
- };
- struct circle {
- point o;
- double r;
- double area() {
- return 3.14 * r * r;
- }
- double perimetr() {
- return 2 * 3.14 * r;
- }
- };
- int main() {
- circle a;
- a.o.x = 10;
- a.o.y = 10;
- a.r = 5;
- cout << a.area() << endl;
- cout << a.perimetr() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement