0% found this document useful (0 votes)
26 views5 pages

Experiment 19

Uploaded by

bondgemadhav033
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views5 pages

Experiment 19

Uploaded by

bondgemadhav033
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment 19

#include <iostream>

using namespace std;

class Counter {

private:

int count;

public:

Counter() : count(0) {}

Counter operator++() {

++count;

return *this;

friend Counter operator--(Counter &c);

void display() const {

cout << "Count: " << count << endl;

};

Counter operator--(Counter &c) {

--c.count;
return c;

int main() {

Counter c;

c.display();

++c;

c.display();

--c;

c.display();

return 0;

o/p:-
#include <iostream>

#include <cmath>

using namespace std;

double area(double radius) {

return M_PI * radius * radius;

double circumference(double radius) {

return 2 * M_PI * radius;

double area(double length, double width) {

return length * width;

double area(double base, double height, int) {

return 0.5 * base * height;

int main() {

double radius = 5.0;

double length = 10.0, width = 4.0;

double base = 8.0, height = 5.0;


cout << "Area of Circle: " << area(radius) << endl;

cout << "Circumference of Circle: " << circumference(radius) << endl;

cout << "Area of Rectangle: " << area(length, width) << endl;

cout << "Area of Triangle: " << area(base, height, 0) << endl;

return 0;

o/p:-

You might also like