#include <iostream>
class Counter {
private:
int number_of_visited;
float total_amount;
public:
void init() {
this->number_of_visited = 0;
this->total_amount = 0;
}
void sold() {
this->number_of_visited++;
this->total_amount += 500; // Rs.500
}
void show() {
std::cout << "number of visited people:" << this->number_of_visited << std::endl;
std::cout << "total amount:" << this->total_amount << std::endl;
}
};
int main()
{
Counter c;
c.init();
c.sold();
c.show();
c.sold();
c.sold();
c.sold();
s.show();
return 0;
}
Comments
Leave a comment