0% found this document useful (0 votes)
13 views

Using Using Using Using Using Using Namespace Class: Program

The document describes a menu-driven program for managing trainee data. It allows adding a trainee by entering their CIN, name, surname, and age, and displays a list of all trainees by iterating through an array and calling ToString on each object.

Uploaded by

Mohamed Elhajam
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Using Using Using Using Using Using Namespace Class: Program

The document describes a menu-driven program for managing trainee data. It allows adding a trainee by entering their CIN, name, surname, and age, and displays a list of all trainees by iterating through an array and calling ToString on each object.

Uploaded by

Mohamed Elhajam
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace ConsoleApplication2
{
class Program
{

static ArrayList t = new ArrayList();

static void Main(string[] args)


{
int i, choix;
do
{
Console.WriteLine("***** gestion de stagiaires ****");
Console.WriteLine("1------------Ajouter");
Console.WriteLine("2------------Modifier");
Console.WriteLine("3------------Supprimer");
Console.WriteLine("4------------Rechercher");
Console.WriteLine("5------------Lister");
Console.WriteLine("saisir un choix entre 1 et 5 , 6 pour quitter");
choix = int.Parse(Console.ReadLine());

switch (choix)
{
case 1:
{
string c, n, p;
int a;
Console.WriteLine("saisir le CIN");
c = Console.ReadLine();
Console.WriteLine("saisir le nom");
n = Console.ReadLine();
Console.WriteLine("saisir le prenom");
p = Console.ReadLine();
Console.WriteLine("saisir l'age");
a = int.Parse(Console.ReadLine());

stagiaire s = new stagiaire(c, n, p, a);


t.Add(s);
break;
}
case 2: { break; }
case 3: { break; }
case 4: { break; }
case 5:
{
Console.WriteLine("cin" +"\t" +"nom" +"\t" +"prenom"+"\t" +
"age" );
for (i = 0; i < t.Count; i++)
{
stagiaire s0 = new stagiaire();
s0 = (stagiaire)t[i];
Console.WriteLine(s0.ToString());

break;
}

} while (choix != 6);


}
}
}

You might also like