You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
179 lines
4.6 KiB
179 lines
4.6 KiB
using Model;
|
|
using System.IO;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace MyProject;
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
menusPrincipal();
|
|
//testdebase();
|
|
//testCompte();
|
|
//testAnimal();
|
|
//testRace();
|
|
}
|
|
|
|
private static void menusPrincipal()
|
|
{
|
|
Console.Clear();
|
|
Console.WriteLine("Menus principal");
|
|
Console.WriteLine("1- Les espèces");
|
|
Console.WriteLine("2- Vos animaux");
|
|
Console.WriteLine("9- Quitter");
|
|
|
|
Console.Write("Entrer votre choix : ");
|
|
int choix = Convert.ToInt32(Console.ReadLine());
|
|
|
|
switch (choix)
|
|
{
|
|
case 1:
|
|
menusEspece();
|
|
break;
|
|
case 2:
|
|
menusAnimal();
|
|
break;
|
|
case 9:
|
|
return;
|
|
default:
|
|
Console.WriteLine("Choix incorrect");
|
|
break;
|
|
}
|
|
}
|
|
|
|
private static void menusEspece()
|
|
{
|
|
Console.Clear();
|
|
Console.WriteLine("Menus des espèces");
|
|
Console.WriteLine("1- Afficher les espèces");
|
|
Console.WriteLine("2- ");
|
|
Console.WriteLine("9- Quitter");
|
|
|
|
Console.Write("Entrer votre choix : ");
|
|
int choix = Convert.ToInt32(Console.ReadLine());
|
|
|
|
switch (choix)
|
|
{
|
|
case 1:
|
|
afficherEspece();
|
|
break;
|
|
case 9:
|
|
return;
|
|
default:
|
|
Console.WriteLine("Choix incorrect");
|
|
break;
|
|
}
|
|
}
|
|
|
|
private static void menusAnimal()
|
|
{
|
|
Console.Clear();
|
|
Console.WriteLine("Menus des animaux");
|
|
Console.WriteLine("1- Afficher les animaux");
|
|
Console.WriteLine("2- Ajouter des animaux");
|
|
Console.WriteLine("9- Quitter");
|
|
|
|
Console.Write("Entrer votre choix : ");
|
|
int choix = Convert.ToInt32(Console.ReadLine());
|
|
|
|
switch (choix)
|
|
{
|
|
case 1:
|
|
afficherAnimaux();
|
|
break;
|
|
case 2:
|
|
ajouterAnimaux();
|
|
break;
|
|
case 9:
|
|
return;
|
|
default:
|
|
Console.WriteLine("Choix incorrect");
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void afficherAnimaux()
|
|
{
|
|
HashSet<Animal> listeAnimaux = new HashSet<Animal>();
|
|
listeAnimaux.Add(new("pouet"));
|
|
listeAnimaux.Add(new("stella"));
|
|
Console.WriteLine();
|
|
foreach (Animal listeAnimau in listeAnimaux)
|
|
{
|
|
Console.WriteLine(listeAnimau.Nom);
|
|
}
|
|
}
|
|
private static void ajouterAnimaux()
|
|
{
|
|
HashSet<Animal> listeAnimaux = new HashSet<Animal>();
|
|
afficherEspece();
|
|
Console.Write("ecrir le num de l'animal de votre choix (ou 9 pour retour) :");
|
|
int num = Convert.ToInt32(Console.ReadLine());
|
|
if (num == 9)
|
|
return;
|
|
Console.WriteLine(num);
|
|
|
|
|
|
Console.Write("ecrir le prenom de l'animal (ou R pour retour) :");
|
|
string nomAnimal = Convert.ToString(Console.ReadLine());
|
|
listeAnimaux.Add(new(nomAnimal));
|
|
afficherAnimaux();
|
|
menusPrincipal();
|
|
}
|
|
|
|
private static void afficherEspece()
|
|
{
|
|
while (true)
|
|
{
|
|
HashSet<Espece> listeEspece = new HashSet<Espece>();
|
|
listeEspece.Add(new(01,"Chien"));
|
|
listeEspece.Add(new(02,"Chat"));
|
|
listeEspece.Add(new(03,"Furet"));
|
|
listeEspece.Add(new(04,"Poisson"));
|
|
listeEspece.Add(new(05,"Hamster"));
|
|
|
|
foreach (Espece lEspece in listeEspece)
|
|
{
|
|
Console.WriteLine(lEspece.Nom);
|
|
}
|
|
Console.Write("Ecrire le num de l'espece pour plus d'info (ou 9 pour retour) :");
|
|
int num = Convert.ToInt32(Console.ReadLine());
|
|
if (num == 9)
|
|
menusPrincipal();
|
|
Console.WriteLine("\nContains: Part with Id=01: {0}", listeEspece.Contains(new(01, "")));
|
|
|
|
|
|
for (int i = 0; i <= num; i++)
|
|
//if (num == listeEspece[i])
|
|
Console.WriteLine();
|
|
Espece ours = new Espece(20, "Ours");
|
|
ours.afficherInfo();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void testdebase()
|
|
{
|
|
|
|
}
|
|
|
|
void testAnimal()
|
|
{
|
|
|
|
}
|
|
void testRace()
|
|
{
|
|
|
|
}
|
|
} |