-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjetGrapheCPP.cpp
More file actions
61 lines (47 loc) · 1.46 KB
/
ProjetGrapheCPP.cpp
File metadata and controls
61 lines (47 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// ProjetGrapheCPP.cpp : Ce fichier contient la fonction 'main'. L'exécution du programme commence et se termine à cet endroit.
//
using namespace std;
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include "PArc.hpp"
#include "PSommet.hpp"
#include "PGraphOrient.hpp"
#include "PGraph.hpp"
#include "CParser.hpp"
int main(int argc, char* argv[])
{
if (argc != 2) {
cout << "Erreur : Aucun ou trop de fichier fourni" << endl;
return 1;
}
ifstream FILE(argv[1]);
cout << "Creation du graphe..." << endl << endl;
CParser Parser;
Parser.PARRecupType(FILE);
if (Parser.PARLireType() == "entier") {
cout << "===== GRAPHE ORIENTE =====" << endl << endl;
PGraphOrient<unsigned int>* Graphe = Parser.PARGROEntierNS(FILE);
Graphe->GROAfficher();
Graphe->GROFinaliser();
PGraphOrient<unsigned int>* GrapheInverse = Graphe->GROInverser();
cout << "===== GRAPHE INVERSE =====" << endl << endl;
GrapheInverse->GROAfficher();
vector<PSommet<unsigned int>*> vec = Graphe->GROCycleHamiltonien(Graphe->GROLireSommet(0));
delete GrapheInverse;
delete Graphe;
}
else {
cout << "===== GRAPHE ORIENTE =====" << endl << endl;
PGraphOrient<void*>* Graphe = Parser.PARGrapheO(FILE);
Graphe->GROAfficher();
Graphe->GROFinaliser();
PGraphOrient<void*>* GrapheInverse = Graphe->GROInverser();
cout << "===== GRAPHE INVERSE =====" << endl << endl;
GrapheInverse->GROAfficher();
delete GrapheInverse;
delete Graphe;
}
return 0;
}