Bonsoir s'il vous plait jeter un peu un coup d'oeil sur mon code ci-dessous et me dites ou je plante parce j'ai le message ci dessous à l’exécution du programme généré
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
PROGRAMME DE TEST
Erreur de segmentation
et voila mes trois fichier
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
 
/***********************************CLIENT.CC*********************************************/
// Include de l'application
#include "Vecteur.h"
 
int main(int argc, char **argv)
{
 
	cout << "PROGRAMME DE TEST" << endl;
 
	// Constructeurs
	vecteur v1(3);
	vecteur v2 = v1;
	vecteur v3;
 
	v1[0] = 2;
	v1[1] = 4;
	v1[2] = 6;
	cout << "v1 :	" << v1 << endl;
 
	v2 = v1;
	cout << "v2 = v1 :	" << v2 << endl;
 
	v2++;
	cout << "v2++ :	" << v2 << endl;
 
	v3 = v1 + v2;
	cout << "v3 = v1 + v2 :	" << v3 << endl;
 
 
	cout << "SORTIE TEST" << endl;
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
 
 
/*******************************************VECTEUR.CC******************************************/
// Type vecteur
#include "Vecteur.h"
 
// Constructeurs
vecteur::vecteur(){taille=0; tab=NULL;}
vecteur::vecteur(int){}
 
vecteur::vecteur(const vecteur& m_v){
	this->taille=m_v.taille;
	this->tab = new int [this->taille];
	for(int i=0;i<=this->taille;i++){
		this->tab[i]=m_v.tab[i];
	}
}
 
 
// Destructeur
vecteur::~vecteur(){
	delete [] this->tab;
}
 
// Nombre d'elements
//int vecteur::longueur(void)
//{
//}
 
// Acces aux elements
int& vecteur::operator[](int i)
{
	for( i=0; i<=this->taille;i++)
	{
		return this->tab[i];
	}
}
 
// affectation : =(vecteur), =(int)
vecteur& vecteur::operator=(const vecteur& m_v){
	this->taille = m_v.taille;
	delete [] this->tab;
	this->tab = new int [ this->taille];
	for(int i=0;i<=m_v.taille;i++){
		this->tab[i] = m_v.tab[i];
	}
	return *this;
}
// incrementation/decr. : ++, ++(int), --
 
vecteur& vecteur::operator++(){
 
	for (int i;i<=this->taille;i++){
	this->tab[i]+=1;
	}
	return *this;
}
 
vecteur vecteur::operator++(int){
	vecteur rec(*this);
	for(int i=0;i<=this->taille;i++)
	{
		this->tab[i]+=1;
	}
	return rec;
}
// op. booleens : ==, <, >, <=, >=
bool vecteur::operator==(const vecteur& m_v){
	for (int i =0;i<=this->taille;i++){
		return this->tab[i]==m_v.tab[i];
	}
}
 
bool vecteur::operator<(const vecteur& m_v){
	for (int i =0; i<=this->taille; i++){
		return this->tab[i]<m_v.tab[i];
	}
}
 
bool vecteur::operator>(const vecteur& m_v){
	for (int i=0; i<=this->taille;i++){
		return this->tab[i]>m_v.tab[i];
	}
}
 
bool vecteur::operator<=(const vecteur& m_v){
	for (int i =0; i<=this->taille; i++){
		return this->tab[i]<=m_v.tab[i];
	}
}
bool vecteur::operator>=(const vecteur& m_v){
	for (int i=0; i<=this->taille;i++){
		return this->tab[i]>=m_v.tab[i];
	}
}
 
// op. binaires : +, -
vecteur& vecteur::operator+(const vecteur& m_v){
	for (int i=0; i<=this->taille; i++){
		this->tab[i]+=m_v.tab[i];}
}
vecteur& vecteur::operator-(const vecteur& m_v){
	for (int i=0; i<=this->taille; i++){
		this->tab[i]-=m_v.tab[i];}
}
 
 
 
// produit scalaire : *
 
vecteur& vecteur::operator*(const vecteur& m_v){
	for (int i=0; i<=this->taille; i++){
		this->tab[i]*=m_v.tab[i];}
}
 
 
 
// produit par un scalaire: n * v, v * n
/*vecteur& vecteur::operatorµ(const vecteur& m_v, int n){	
	for (int i=0; i<=this->taille; i++){
		this->tab[i] = this->tab[i]*n;}
}*/
 
 
// auto-adition : +=, -=
 
// Operateurs d'entree/sortie: <<, >>
ostream& operator<< (ostream& o, vecteur& a)
{
	return o;
}
 
istream& operator>> (istream& i, vecteur& a)
{
	return i;
}

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
62
63
64
65
66
67
68
69
70
71
72
73
74
 
/***************************************VECTEUR.H**********************************************/
 
#ifndef VECTEUR_H
#define VECTEUR_H
//
// Type vecteur
//
#include <iostream>
 
using namespace std;
 
//
// Type vecteur de int
//
class vecteur
{
private:
	int taille;
	int * tab;
 
public:
 
// Constructeurs par defaut(void) , avec la taille du vect.(int), par copie(vecteur&)
vecteur(int);
vecteur();
//vecteur(int tail);
vecteur(const vecteur&);
 
// Destructeur
~vecteur();
 
// Acces a la taille du vecteur
//int longueur(void);
//int longeur();
 
// acces au element []
//int& operator[](int);
int& operator[](int);
 
// affectation : =(vecteur), =(int)
vecteur& operator=(const vecteur& m_v);
// incrementation/decr. : ++(void), ++(int), --(void)
vecteur& operator++();
vecteur	 operator++(int);
vecteur& operator--();
// op. booleens : ==(vecteur&), <, >, <=, >=
bool operator==(const vecteur& m_v);
bool operator<(const vecteur& m_v);
bool operator>(const vecteur& m_v);
bool operator<=(const vecteur& m_v);
bool operator>=(const vecteur& m_v);
// op. binaires : +(vecteur&), -
vecteur& operator+(const vecteur& m_v);
vecteur& operator-(const vecteur& m_v);
//vecteur& operatorµ(const vecteur& m_v ,int n);
 
// produit scalaire: *(vecteur&)
vecteur& operator*(const vecteur& m_v);
// produit par un scalaire: v * n, n * v
//vecteur operator*(int);
vecteur& operator*(int);
//friend vecteur operator*(int, vecteur&);
 
// auto-adition : +=(vecteur&), -=
vecteur& operator+=(const vecteur& m_v);
vecteur& operator-=(const vecteur& m_v);
// Operateurs d'entree/sortie: <<, >>
friend ostream& operator<< (ostream&, vecteur&);
friend istream& operator>> (istream&, vecteur&);
 
};
 
#endif // VECTEUR_H
merci d'avance