/******************************************************************************
Online C# Compiler.
Code, Compile, Run and Debug C# program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
using System;
class HelloWorld {
public static Result Calc1(int a, int b)
{
Result r = new Result(a + b, a - b);
return r;
//// المجموع
//return a + b;
////الفرق
//return a - b;
}
public static int Calc(int a, int b)
{
// المجموع
return a + b;
//الفرق
return a - b;
}
public static string CalcJumana(int a, int b)
{
int t = a + b;
int s = a - b;
// المجموع الفرق
return t.ToString()+","+ s.ToString();
}
public static int Calc2(int a, int b, out int c)
{
c= a - b;
// المجموع
return a + b;
}
public static void test01()
{
Console.WriteLine("test01:");
Console.WriteLine();
string appp = CalcJumana(12, 7);
string[] ress = appp.Split(',');
Console.WriteLine(appp);
Console.WriteLine(ress[0]);
Console.WriteLine(ress[1]);
}
public static void test02()
{
Console.WriteLine("test02:");
Console.WriteLine();
//1
int zz = Calc(12, 7);
Console.WriteLine(zz);
}
public static void test03()
{
Console.WriteLine("test03:");
Console.WriteLine();
int rOut;
int app = Calc2(12, 7,out rOut);
Console.WriteLine(app);
Console.WriteLine(rOut);
}
public static void test04()
{
Console.WriteLine("test04:");
Console.WriteLine();
Result ap = Calc1(12, 7);
Console.WriteLine(ap.GetTotal());
Console.WriteLine(ap.GetDiff());
}
static void Main() {
Console.WriteLine("Hello World");
test01();
test02();
test03();
test04();
}
}
public class Result
{
private int total;
private int diff;
public int GetTotal()
{
return this.total;
}
public int GetDiff()
{
return this.diff;
}
public Result(int t, int d)
{
this.total = t;
this.diff = d;
}
}