TP5
This commit is contained in:
9
TP5/ETUDB.txt
Normal file
9
TP5/ETUDB.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
7
|
||||||
|
Etud1
|
||||||
|
Etud2
|
||||||
|
Etud3
|
||||||
|
Etud4
|
||||||
|
Etud5
|
||||||
|
Etud6
|
||||||
|
Etud7
|
||||||
6
TP5/PROF.txt
Normal file
6
TP5/PROF.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
5
|
||||||
|
Prof1;Informatique;
|
||||||
|
Prof2;Informatique;
|
||||||
|
Prof3;Mathematique;
|
||||||
|
Prof4;Physique;
|
||||||
|
Prof5;Chimie;
|
||||||
9
TP5/PROF.xsd
Normal file
9
TP5/PROF.xsd
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xs:schema id="PROF"
|
||||||
|
targetNamespace="http://tempuri.org/PROF.xsd"
|
||||||
|
elementFormDefault="qualified"
|
||||||
|
xmlns="http://tempuri.org/PROF.xsd"
|
||||||
|
xmlns:mstns="http://tempuri.org/PROF.xsd"
|
||||||
|
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||||
|
>
|
||||||
|
</xs:schema>
|
||||||
31
TP5/TP5.sln
Normal file
31
TP5/TP5.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}") = "TP5", "TP5.vcxproj", "{5ED86EF3-56FC-47BB-8158-B3DA0C5C17C9}"
|
||||||
|
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
|
||||||
|
{5ED86EF3-56FC-47BB-8158-B3DA0C5C17C9}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{5ED86EF3-56FC-47BB-8158-B3DA0C5C17C9}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{5ED86EF3-56FC-47BB-8158-B3DA0C5C17C9}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{5ED86EF3-56FC-47BB-8158-B3DA0C5C17C9}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{5ED86EF3-56FC-47BB-8158-B3DA0C5C17C9}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{5ED86EF3-56FC-47BB-8158-B3DA0C5C17C9}.Release|x64.Build.0 = Release|x64
|
||||||
|
{5ED86EF3-56FC-47BB-8158-B3DA0C5C17C9}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{5ED86EF3-56FC-47BB-8158-B3DA0C5C17C9}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {751FCA9B-3D1B-4953-B0CB-D7CA089CBB38}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
139
TP5/TP5.vcxproj
Normal file
139
TP5/TP5.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>{5ed86ef3-56fc-47bb-8158-b3da0c5c17c9}</ProjectGuid>
|
||||||
|
<RootNamespace>TP5</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>
|
||||||
|
<ClCompile Include="main.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ETUDB.txt" />
|
||||||
|
<Text Include="PROF.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
30
TP5/TP5.vcxproj.filters
Normal file
30
TP5/TP5.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>
|
||||||
|
<ClCompile Include="main.cpp">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="PROF.txt">
|
||||||
|
<Filter>Fichiers de ressources</Filter>
|
||||||
|
</Text>
|
||||||
|
<Text Include="ETUDB.txt">
|
||||||
|
<Filter>Fichiers de ressources</Filter>
|
||||||
|
</Text>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
4
TP5/TP5.vcxproj.user
Normal file
4
TP5/TP5.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>
|
||||||
215
TP5/main.cpp
Normal file
215
TP5/main.cpp
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <string>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class ETUD {
|
||||||
|
int Id;
|
||||||
|
string nom;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ETUD() { static int i = 0; Id = ++i; }
|
||||||
|
~ETUD() { cout << "Disparition de l'étudiant ID=" << Id << endl; }
|
||||||
|
|
||||||
|
void saisie(string ligne) { nom = ligne.substr(0, ligne.find(';')); };
|
||||||
|
void affiche() { cout << setw(4) << Id << left << setw(2) << nom; }
|
||||||
|
void saisie() { cout << "Nom :"; cin.ignore(); getline(cin, nom); }
|
||||||
|
|
||||||
|
string getNom() { return nom; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class PROF {
|
||||||
|
int Id;
|
||||||
|
string nom, service;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PROF() { static int i = 0; Id = ++i; }
|
||||||
|
~PROF() { cout << "Disparition du prof ID=" << Id << endl; }
|
||||||
|
|
||||||
|
void saisie(string ligne) { int i = ligne.find(';'); nom = ligne.substr(0, i); service = ligne.substr(i + 1, ligne.find(';', i+1) - i - 1); };
|
||||||
|
void affiche() { cout << left << setw(4) << Id << left << setw(8) << nom << " " << left << setw(8) << service; }
|
||||||
|
void saisie() { cout << "Nom :"; cin.ignore(); getline(cin, nom); cout << "Service :"; cin.ignore(); getline(cin, service); }
|
||||||
|
|
||||||
|
string getNom() { return nom; }
|
||||||
|
};
|
||||||
|
|
||||||
|
int menu() {
|
||||||
|
int choix;
|
||||||
|
cout << "Entrez votre choix : \n"
|
||||||
|
<< " 1. Lire fichier PROF et stocker les données dans un Vector + Affichage\n"
|
||||||
|
<< " 2. Lire fichier ETUDB et stocker les données dans une List + Affichage\n"
|
||||||
|
<< " 3. Ajouter un PROF au début du Vector + Afficher\n"
|
||||||
|
<< " 4. Ajouter un ETUD au début de List + Afficher\n"
|
||||||
|
<< " 5. Supprimer le PROF et ETUD au début de Vector et List + Affichage\n"
|
||||||
|
<< " 6. Créer une List2 contenant uniquement les noms des ETUD et PROF \n"
|
||||||
|
<< " 7. Quitter " << endl;
|
||||||
|
cin >> choix;
|
||||||
|
return choix;
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <class C, class O>
|
||||||
|
template <class C>
|
||||||
|
void lire(C& c, string nomfichier) {
|
||||||
|
ifstream fichier(nomfichier);
|
||||||
|
int N;
|
||||||
|
string ligne;
|
||||||
|
|
||||||
|
if (!fichier) {
|
||||||
|
cout << "Une erreur est survenue lors de la lecture du fichier" << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fichier >> N;
|
||||||
|
fichier.ignore();
|
||||||
|
while (N-- > 0) {
|
||||||
|
getline(fichier, ligne);
|
||||||
|
// O o;
|
||||||
|
// o.saisie(ligne);
|
||||||
|
// c.insert(c.end(), o);
|
||||||
|
|
||||||
|
// https://cplusplus.com/reference/vector/vector/emplace/
|
||||||
|
// https://cplusplus.com/reference/list/list/emplace/
|
||||||
|
c.emplace(c.end())->saisie(ligne);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
void affiche(C& conteneur) {
|
||||||
|
cout << "Ce conteneur contient" << endl;
|
||||||
|
for (auto& o : conteneur) {
|
||||||
|
cout << endl;
|
||||||
|
o.affiche();
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
void lire_puis_affiche(C& conteneur, string nomfichier) {
|
||||||
|
lire(conteneur, nomfichier);
|
||||||
|
affiche(conteneur);
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <class C, class O>
|
||||||
|
template <class C>
|
||||||
|
void ajoutdebut_affiche(C& conteneur) {
|
||||||
|
conteneur.emplace(conteneur.begin())->saisie();
|
||||||
|
affiche(conteneur);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
void supprimedebut_affiche(C& conteneur) {
|
||||||
|
conteneur.erase(conteneur.begin());
|
||||||
|
affiche(conteneur);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
void remplirliste_nom(C& c, list<string>& l) {
|
||||||
|
for (auto& o : c) {
|
||||||
|
l.push_back(o.getNom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void affiche(list<string>& l) {
|
||||||
|
cout << "Voici la liste des noms des etudiants et des PROFs" << endl;
|
||||||
|
for (auto& o : l) {
|
||||||
|
cout << endl << o;
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
|
list<ETUD> etuds;
|
||||||
|
vector<PROF> profs;
|
||||||
|
|
||||||
|
list<string> list2;
|
||||||
|
|
||||||
|
profs.reserve(10);
|
||||||
|
|
||||||
|
int choix;
|
||||||
|
|
||||||
|
while ((choix = menu()) != 7) {
|
||||||
|
switch (choix) {
|
||||||
|
case 1:
|
||||||
|
//lire<vector<PROF>, PROF>(profs, "PROF.txt");
|
||||||
|
lire_puis_affiche(profs, "PROF.txt");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
//lire<list<ETUD>, ETUD>(etuds, "ETUDB.txt");
|
||||||
|
lire_puis_affiche(etuds, "ETUDB.txt");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
ajoutdebut_affiche(profs);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
ajoutdebut_affiche(etuds);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
supprimedebut_affiche(etuds);
|
||||||
|
supprimedebut_affiche(profs);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
remplirliste_nom(etuds, list2);
|
||||||
|
remplirliste_nom(profs, list2);
|
||||||
|
affiche(list2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
template <class Conteneur, class T>
|
||||||
|
void fonction_template(Conteneur& conteneur) {
|
||||||
|
T monobjet;
|
||||||
|
|
||||||
|
conteneur.push_back(monobjet);
|
||||||
|
}
|
||||||
|
|
||||||
|
void exemple_template() {
|
||||||
|
list<PROF> profs;
|
||||||
|
profs.push_back
|
||||||
|
|
||||||
|
int varI = 0;
|
||||||
|
|
||||||
|
fonction_template<list<PROF>, PROF>(profs);
|
||||||
|
|
||||||
|
fonction_template<list<PROF>, string>(profs);
|
||||||
|
|
||||||
|
fonction_template<int, string>(varI);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
// expand la fonction template comme ceci
|
||||||
|
void fonction_template(list<PROF>& conteneur) {
|
||||||
|
PROF monobjet;
|
||||||
|
|
||||||
|
conteneur.push_back(monobjet);
|
||||||
|
}
|
||||||
|
|
||||||
|
// expand la fonction template comme ceci (avec le 2e)
|
||||||
|
void fonction_template(list<PROF>& conteneur) {
|
||||||
|
string monobjet;
|
||||||
|
|
||||||
|
conteneur.push_back(monobjet);
|
||||||
|
}
|
||||||
|
|
||||||
|
// expand la fonction template comme ceci (avec le 3e)
|
||||||
|
void fonction_template(int& conteneur) {
|
||||||
|
string monobjet;
|
||||||
|
|
||||||
|
conteneur.push_back(monobjet);
|
||||||
|
}*/
|
||||||
Reference in New Issue
Block a user