TP8: Papillons
This commit is contained in:
BIN
TP8/PAPILLONS/Côté_LES PAPILLONS_24.pdf
Normal file
BIN
TP8/PAPILLONS/Côté_LES PAPILLONS_24.pdf
Normal file
Binary file not shown.
31
TP8/PAPILLONS/PAPILLONS.sln
Normal file
31
TP8/PAPILLONS/PAPILLONS.sln
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.7.34221.43
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PAPILLONS", "PAPILLONS.vcxproj", "{EA3BDFDD-EE87-4A19-BF13-B5B55F4FDE50}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{EA3BDFDD-EE87-4A19-BF13-B5B55F4FDE50}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{EA3BDFDD-EE87-4A19-BF13-B5B55F4FDE50}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{EA3BDFDD-EE87-4A19-BF13-B5B55F4FDE50}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{EA3BDFDD-EE87-4A19-BF13-B5B55F4FDE50}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{EA3BDFDD-EE87-4A19-BF13-B5B55F4FDE50}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{EA3BDFDD-EE87-4A19-BF13-B5B55F4FDE50}.Release|x64.Build.0 = Release|x64
|
||||||
|
{EA3BDFDD-EE87-4A19-BF13-B5B55F4FDE50}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{EA3BDFDD-EE87-4A19-BF13-B5B55F4FDE50}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {464C1159-1EE2-4873-AD3C-6E29E4DB6FB0}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
139
TP8/PAPILLONS/PAPILLONS.vcxproj
Normal file
139
TP8/PAPILLONS/PAPILLONS.vcxproj
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>17.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{ea3bdfdd-ee87-4a19-bf13-b5b55f4fde50}</ProjectGuid>
|
||||||
|
<RootNamespace>PAPILLONS</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="PapB.txt" />
|
||||||
|
<Text Include="PapJ.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
30
TP8/PAPILLONS/PAPILLONS.vcxproj.filters
Normal file
30
TP8/PAPILLONS/PAPILLONS.vcxproj.filters
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Fichiers sources">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Fichiers d%27en-tête">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Fichiers de ressources">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="PapJ.txt">
|
||||||
|
<Filter>Fichiers de ressources</Filter>
|
||||||
|
</Text>
|
||||||
|
<Text Include="PapB.txt">
|
||||||
|
<Filter>Fichiers de ressources</Filter>
|
||||||
|
</Text>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.cpp">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
4
TP8/PAPILLONS/PAPILLONS.vcxproj.user
Normal file
4
TP8/PAPILLONS/PAPILLONS.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup />
|
||||||
|
</Project>
|
||||||
4
TP8/PAPILLONS/PapB.txt
Normal file
4
TP8/PAPILLONS/PapB.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
3
|
||||||
|
P5;B;
|
||||||
|
Chrys;B;
|
||||||
|
P6;B;
|
||||||
5
TP8/PAPILLONS/PapJ.txt
Normal file
5
TP8/PAPILLONS/PapJ.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
4
|
||||||
|
P1;J;
|
||||||
|
Bap;J;
|
||||||
|
Buti;J;
|
||||||
|
P4;J;
|
||||||
228
TP8/PAPILLONS/main.cpp
Normal file
228
TP8/PAPILLONS/main.cpp
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class Papillon {
|
||||||
|
string Nom;
|
||||||
|
char couleur;
|
||||||
|
public:
|
||||||
|
Papillon() {};
|
||||||
|
Papillon(char couleur) : couleur(couleur) {};
|
||||||
|
|
||||||
|
void saisie(ifstream& f);
|
||||||
|
void saisie();
|
||||||
|
void afficher();
|
||||||
|
|
||||||
|
string nomcouleur() {
|
||||||
|
return couleur == 'J' ? "Jaune" : "Bleu";
|
||||||
|
}
|
||||||
|
|
||||||
|
char getcouleur() {
|
||||||
|
return couleur;
|
||||||
|
}
|
||||||
|
|
||||||
|
string getnom() {
|
||||||
|
return Nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator<(Papillon b) {
|
||||||
|
return Nom > b.Nom; /* tri décroissant */
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(Papillon p) {
|
||||||
|
return Nom == p.Nom && couleur == p.couleur;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void lecture(T& cont, const string name) {
|
||||||
|
ifstream f(name);
|
||||||
|
|
||||||
|
if (!f.is_open()) {
|
||||||
|
cout << "Erreur lors de l'ouverture du fichier" << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int n;
|
||||||
|
|
||||||
|
f >> n; f.ignore();
|
||||||
|
|
||||||
|
while (!f.eof()) {
|
||||||
|
Papillon p;
|
||||||
|
|
||||||
|
p.saisie(f);
|
||||||
|
f.ignore();
|
||||||
|
cont.insert(cont.begin(), p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void afficher_el(T& el) {
|
||||||
|
el.afficher();
|
||||||
|
}
|
||||||
|
|
||||||
|
void afficher_el(string el) {
|
||||||
|
cout << el;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void afficher(T cont) {
|
||||||
|
for (auto el : cont) {
|
||||||
|
// el.afficher();
|
||||||
|
afficher_el(el);
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void tri_affichage(T& cont) {
|
||||||
|
sort(cont.begin(), cont.end());
|
||||||
|
|
||||||
|
afficher(cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
// spécialisation de template
|
||||||
|
template <class A>
|
||||||
|
void tri_affichage(list<A>& cont) {
|
||||||
|
cont.sort(); afficher(cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
Papillon saisie_papillon() {
|
||||||
|
Papillon p;
|
||||||
|
p.saisie();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class A>
|
||||||
|
bool effacer_papillon(A& cont, Papillon rec) {
|
||||||
|
auto it = find(cont.begin(), cont.end(), rec);
|
||||||
|
|
||||||
|
if (it == cont.end()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cont.erase(it);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void effacer_papillon(list<Papillon>& cont1, vector<Papillon>& cont2) {
|
||||||
|
Papillon p = saisie_papillon();
|
||||||
|
|
||||||
|
if (!effacer_papillon(cont1, p)) {
|
||||||
|
cout << "Papillon non trouvé dans la liste jaune"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!effacer_papillon(cont2, p)) {
|
||||||
|
cout << "Papillon non trouvé dans le vecteur bleu" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
afficher(cont1);
|
||||||
|
afficher(cont2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void remplir_set(T cont, set<string>& s) {
|
||||||
|
for (auto a : cont) {
|
||||||
|
s.insert(a.getnom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int menu() {
|
||||||
|
int c;
|
||||||
|
|
||||||
|
cout << "1) Lire PapJ.txt(Papillon Jaune) et stocker les données dans List" << endl
|
||||||
|
<< "2) Lire PapB.txt(Papillon Bleu) et stocker les données dans Vector" << endl
|
||||||
|
<< "3) Tri par ordre décroissant selon le nom + Affichage" << endl
|
||||||
|
<< "4) Ajout d’1 Papillon dans List ou Vector selon sa couleur + Affichage" << endl
|
||||||
|
<< "5) Cherche la position d’1 Papillon dans List et Vector et l’efface" << endl
|
||||||
|
<< "6) Construit un SET avec les noms de tous les Papillons de List et Vector + Affichage" << endl;
|
||||||
|
|
||||||
|
cout << "Choix : ";
|
||||||
|
cin >> c; cin.ignore();
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
list<Papillon> j;
|
||||||
|
vector<Papillon> b;
|
||||||
|
|
||||||
|
set<string> noms;
|
||||||
|
|
||||||
|
Papillon p;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
switch (menu()) {
|
||||||
|
case 1:
|
||||||
|
lecture(j, "PapJ.txt");
|
||||||
|
afficher(j);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
lecture(b, "PapB.txt");
|
||||||
|
afficher(b);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
tri_affichage(j);
|
||||||
|
tri_affichage(b);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
p = saisie_papillon();
|
||||||
|
if (p.getcouleur() == 'J') {
|
||||||
|
j.push_back(p);
|
||||||
|
afficher(j);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
b.push_back(p);
|
||||||
|
afficher(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
effacer_papillon(j, b);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
noms.clear();
|
||||||
|
remplir_set(j, noms);
|
||||||
|
remplir_set(b, noms);
|
||||||
|
afficher(noms);
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Papillon::saisie(ifstream& f) {
|
||||||
|
getline(f, Nom, ';');
|
||||||
|
f >> couleur; f.ignore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Papillon::afficher() {
|
||||||
|
cout << left << setw(8) << Nom << " " << nomcouleur();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Papillon::saisie() {
|
||||||
|
cout << "Nom : ";
|
||||||
|
getline(cin, Nom);
|
||||||
|
|
||||||
|
couleur = '\0';
|
||||||
|
while (couleur != 'J' && couleur != 'B') {
|
||||||
|
cout << "Couleur (J/B) : ";
|
||||||
|
cin >> couleur; cin.ignore();
|
||||||
|
couleur = toupper(couleur);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user