Вы находитесь на странице: 1из 1

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Count
{
class CounterType
{
private int count = 0;
public void set(int a)
{
count = a;
}
public void increase()
{
count = count + 1;
}
public void decrease()
{
count = count - 1;
}
public void display()
{
Console.WriteLine("Count = " + count);
}
};
class Program
{
static void Main(string[] args)
{
CounterType obj = new CounterType();
obj.set(5);
obj.increase();
obj.increase();
obj.increase();
obj.increase();
obj.increase();
obj.decrease();
obj.decrease();
obj.display();
Console.ReadLine();
}
}
}

Вам также может понравиться