dessel191

Calc

May 8th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace WindowsFormsApp1
  8. {
  9.     public static class Calc
  10.     {
  11.         private static double memory;
  12.  
  13.         public static void MemPlus (double a)
  14.         {
  15.             memory += a;
  16.         }
  17.  
  18.         public static void MemMinus (double a)
  19.         {
  20.             memory -= a;
  21.         }
  22.  
  23.         public static void MemCLR()
  24.         {
  25.             memory = 0;
  26.         }
  27.  
  28.         public static double MemR()
  29.         {
  30.             return memory;
  31.         }
  32.  
  33.         public static double Suma (double a, double b)
  34.         {
  35.             return a + b;
  36.         }
  37.  
  38.         public static double Roznica ( double a, double b)
  39.         {
  40.             return a - b;
  41.         }
  42.  
  43.         public static double Iloczyn ( double a, double b)
  44.         {
  45.             return a * b;
  46.         }
  47.         public static double Iloraz ( double a, double b)
  48.         {
  49.             if (b == 0)
  50.                 throw new Exception();
  51.             else
  52.                 return a / b;
  53.         }
  54.         public static double Negacja ( double a)
  55.         {
  56.             return -1 * a;
  57.         }
  58.         public static double Kwadrat (double a)
  59.         {
  60.             return a * a;
  61.         }
  62.         public static double Odwr (double a)
  63.         {
  64.             return 1 / a;
  65.         }
  66.         public static double Sqrt (double a)
  67.         {
  68.             if (a < 0)
  69.                 throw new Exception();
  70.             else
  71.             {
  72.                 return Math.Sqrt(a);
  73.             }
  74.         }
  75.  
  76.         public static double Procent (double a)
  77.         {
  78.             return a / 100;
  79.         }
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment