79 lines
1.7 KiB
C#
79 lines
1.7 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
namespace AkiragestuProject
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 基本计算类
|
|||
|
/// </summary>
|
|||
|
class akOperation
|
|||
|
{
|
|||
|
akMood akm = new akMood();
|
|||
|
/// <summary>
|
|||
|
/// 加法
|
|||
|
/// </summary>
|
|||
|
/// <param name="f1"></param>
|
|||
|
/// <param name="f2"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public string Addition(string Addstr)
|
|||
|
{
|
|||
|
string[] Arr = Addstr.Split('+');
|
|||
|
|
|||
|
|
|||
|
int cstr = 0;
|
|||
|
foreach(var a in Arr)
|
|||
|
{
|
|||
|
cstr+= Convert.ToInt32(a);
|
|||
|
}
|
|||
|
return cstr.ToString();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 减法
|
|||
|
/// </summary>
|
|||
|
/// <param name="f1"></param>
|
|||
|
/// <param name="f2"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public string Subtraction(int f1, int f2)
|
|||
|
{
|
|||
|
|
|||
|
int c = f1 - f2;
|
|||
|
|
|||
|
var cstr = c.ToString();
|
|||
|
return cstr;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 乘法
|
|||
|
/// </summary>
|
|||
|
/// <param name="f1"></param>
|
|||
|
/// <param name="f2"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public string Multiplication(int f1, int f2)
|
|||
|
{
|
|||
|
|
|||
|
int c = f1 * f2;
|
|||
|
|
|||
|
var cstr = c.ToString();
|
|||
|
return cstr;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Division
|
|||
|
/// </summary>
|
|||
|
/// <param name="f1"></param>
|
|||
|
/// <param name="f2"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public string Division(int f1, int f2)
|
|||
|
{
|
|||
|
|
|||
|
int c = f1 / f2;
|
|||
|
|
|||
|
var cstr = c.ToString();
|
|||
|
return cstr;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|