Bonsoir,

Le but de mon programme est de mettre à zéro toutes les cases de ma matrice, mon programme s'exécute mais la matrice ne s'affiche pas dans mon terminal.

Voici mon main.cpp :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
#include <iostream>
#include "graphe.h"
using namespace std;
 
int main()
{
	graphe g;
	init_graphe(g);
}

Voici mon fichier.h :

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
#ifndef GRAPHE
#define GRAPHE
 
typedef int mat[52][52];
 
struct arc_arete
{
	char initial; //sommet initial	
	char finale; //sommet final
	float poids; //cout de l'arc ou arete
};
 
struct graphe
{
	int nature_du_graphe; //valeur 0 si graphe orienté et valeur 1 sinon
	int nb_sommets; //nb de sommets du graphe
	int nbarcs; //nb d'arc du graphe
	char liste_sommets[52]; //liste des sommets du graphe
	arc_arete arcs[100]; //liste des arcs ou aretes du graphe (100 max)
	mat matriceadjacence;
};
 
void init_graphe(graphe &g);
 
#endif
Voici ma fonction.cpp

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
#include <iostream>
#include "graphe.h"
using namespace std;
 
void init_graphe(graphe &g)
{
	int i,j;
	for (i=0; i<g.nb_sommets; i++)
	{
		for (j=0; j<g.nb_sommets; j++)
		{
			g.matriceadjacence[i][j]=0;
			cout<<g.matriceadjacence[i][j]<<endl;
		}
 
	}
 
}
Merci d'avance de me dire ce qui cloche, j'ai du mal à discerner mes erreurs. Merci.
Bonne soirée.