Program: Using Using Using Using Using Namespace Class Static Void Int Try For Int
Program: Using Using Using Using Using Namespace Class Static Void Int Try For Int
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AfficheByIndexOf
{
class Program
{
static void AfficheTab(int[] t)
{
try
{
for(int i=0;i<t.Length/*+2 pour declencher l'exception*/;i++)
Console.WriteLine("t[" + i + "]=" + t[i]);
}
catch (IndexOutOfRangeException)
{
Console.WriteLine("erreur, index pris en dehors des bornes du tableau");
}
}
static void Main(string[] args)
{
int[] t = { 4, 78, 7, 11, 2, 3, 6, 9, 87, 4, 1, 5, 24, 569, 64, 74 };
AfficheTab(t);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace afficheEntier
{
class Program
{
static void Main(string[] args)
{
Console.Write("donner i:");
Console.WriteLine("i=" + Int32.Parse(Console.ReadLine()));
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace listWeek
{
class Program
{
static void Main(string[] args)
{
List<string> jours = new List<string> { "Lundi", "Mardi", "Mercredi", "Jeudi",
"Vendredi", "Samedi", "Dimanche" };
Console.WriteLine("affichage list:");
foreach (string j in jours)
{
Console.WriteLine(j);
}
jours.RemoveAt(1);
Console.WriteLine("affichage list apres suppression de l'element d'indice
1:");
foreach (string j in jours)
{
Console.WriteLine(j);
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Carre
{
class Carre
{
int Long;
public Carre(int l)
{
Long = l;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Point
{
class Point
{
private double x;
private double y;
private static int numPoints;
private double X
{
get
{
return x;
}
set
{
x = value;
}
}
private double Y
{
get
{
return y;
}
set
{
y = value;
}
}
static Point()
{
numPoints = 0;
}
public Point(double xx, double yy)
{
X = xx;
Y = yy;
Console.WriteLine("x=" + X + " et y=" + Y);
numPoints++;
}
}
class Program
{
static void Main(string[] args)
{
Point p1 = new Point(5, 7);
Point.NbInstanceActive();
Point p2 = new Point(2, 5);
Point.NbInstanceActive();
p2.DistanceX_Y(ref p1);
}
}
}