Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp4
- {
- class Program
- {
- static void Main(string[] args)
- {
- Program program = new Program();
- int a = 10;
- int b = 10;
- int wynik = program.OperacjaMetoda(a, b, Operacja.DODAWANIE);
- Console.Write(wynik);
- bool checkGRAY = false;
- bool checkGREY = false;
- checkGRAY = program.ColorMetoda(Color.Gray);
- checkGREY = program.ColorMetoda(Color.Grey);
- Console.WriteLine("checkGray: " + checkGRAY + ", checkGrey: " + checkGREY);
- Console.ReadLine();
- }
- enum Operacja
- {
- DODAWANIE,
- MNOŻENIE
- }
- enum Color
- {
- Black,
- White,
- Gray,
- Grey
- }
- bool ColorMetoda(Color c)
- {
- switch(c)
- {
- case Color.Gray:
- case Color.Grey:
- return true;
- default:
- return false;
- }
- }
- int OperacjaMetoda(int a, int b, Operacja o)
- {
- switch(o)
- {
- case Operacja.DODAWANIE:
- return a + b;
- case Operacja.MNOŻENIE:
- return a * b;
- default:
- return a - b;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement