-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnalyseurBinaire.h
41 lines (39 loc) · 1.05 KB
/
AnalyseurBinaire.h
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
#ifndef ANALYSEURBINAIRE_H_INCLUDED
#define ANALYSEURBINAIRE_H_INCLUDED
#include "Analyseur.h"
#include "Stat.h"
#include <string.h>
class AnalyseurBinaire:public Analyseur{
public:
vector<Stat> analyser(vector<string> motsTraitees,string fichier);
};
vector<Stat> AnalyseurBinaire::analyser(vector<string> motsTraitees,string fichier){
vector<Stat> stats;
for(string word:motsTraitees){
if (stats.size() == 0){
Stat stat;
stat.mot = word;
stat.fichier = fichier;
stat.stat = 1.0;
stats.push_back(stat);
}
else{
bool stat = 0.0;
for (unsigned i=0;i<stats.size();i++){
if (stats[i].mot==word ){
stat = 1.0;
break;
}
}
if (stat == 0.0){
Stat stat;
stat.mot = word;
stat.fichier = fichier;
stat.stat = 1.0;
stats.push_back(stat);
}
}
}
return stats;
};
#endif // ANALYSEURBINAIRE_H_INCLUDED