/******************************************************************************
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 {
static void Main() {
//أنشئ كائنين من هذه الفئة وحدد صفاتها
//الكائن الاول
Triangle Triangle1 = new Triangle();
Triangle1.a = 10;
Triangle1.b = 5;
Triangle1.c = 11;
// متغير نعوض به محيط المثالث 1
int r1 = Triangle1.Moheet();
Console.WriteLine("r1: {0}", r1);
//الكائن الثاني
Triangle Triangle2 = new Triangle();
Triangle2.a = 12;
Triangle2.b = 8;
Triangle2.c = 30;
// متغير نعوض به محيط المثالث 2
int r2 = Triangle2.Moheet();
Console.WriteLine("r2: {0}", r2);
}
}
//تعريف فئة جديدة تدعى
public class Triangle
{
//صفات الكائن
//طول الضلع1
public int a;
//طول الضلع2
public int b;
//طول الضلع3
public int c;
// تعريف العمليات
//المحيط
public int Moheet()
{
return (this.a + this.b + this.c);
}
}