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 WindowsFormsApp1
- {
- public static class Ekran
- {
- private static string s;
- private static bool dot = false;
- private static bool o = false;
- private static int d = 0;
- public static int ostdzialanied()
- {
- return d;
- }
- public static string ostdzialanie()
- {
- switch (d)
- {
- case 0:
- return "";
- case 1:
- return "+";
- case 2:
- return "-";
- case 3:
- return "*";
- case 4:
- return "/";
- case 5:
- return "x^2";
- case 6:
- return "1/x";
- case 7:
- return "%";
- case 8:
- return "+/-";
- case 9:
- return "SQRT";
- default:
- return "";
- }
- }
- public static void setdzialanie(int i)
- {
- d = i;
- }
- public static void set(double a)
- {
- set(a.ToString());
- }
- public static void set(string a)
- {
- s = a;
- }
- public static void add(double a)
- {
- add(a.ToString());
- }
- public static void add(string a)
- {
- if (a.Equals("."))
- {
- if (!dot && !o)
- {
- s += "0.";
- dot = true;
- o = true;
- }
- else if (!dot && o)
- {
- s += ".";
- dot = true;
- }
- }
- else if (a.Equals("0"))
- {
- if (dot)
- {
- s += "0";
- }
- else
- {
- if (!o)
- {
- s += "0";
- o = true;
- }
- }
- }
- else if (a.Equals("00"))
- {
- if(dot)
- {
- s += "00";
- }
- else if (!o)
- {
- o = true;
- s += "0";
- }
- }
- else
- {
- if (!dot && !o)
- s += a;
- else if (dot)
- s += a;
- else if (o && !dot)
- return;
- }
- }
- public static void clr()
- {
- s = null;
- dot = false;
- o = false;
- }
- public static string rets()
- {
- return s;
- }
- public static double retd()
- {
- return Double.Parse(s);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment