Code::Block

fille gl -  
fiddy Messages postés 11653 Date d'inscription   Statut Contributeur Dernière intervention   -
Bonjour,

j'ai installé code::Block et j'ai crée ce programme; mais je n'arrive pas à l'exécuter. en fait il compile et me montre 0 erreur mais je ne vois pas d'exécution!
1-fihcier Mat.h;
#ifndef MAT_H
#define MAT_H
#include <stdio.h>
class Mat
{
public:
float M[100][100];
float M1[100][100];
float M2[100][100];
void saisie(int n);
void produit(int n);
};
#endif

2-fichier Mat.c:
#include "Mat.h"
#include <stdio.h>
void Matrice::saisie(int n)
{
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
srand(time(NULL)); // initialisation de rand
this.M1[i][j]=rand();
srand(time(NULL)); // initialisation de rand
this.M2[i][j]=rand();
}
}
}
void Matrice::produit(int n)
{
int i,j=0,k;
for(k=0;k<=n;k++)
{
i=0;
while(i<n)
{
float s=0;
while(j<n)
{
s=s+this.M1[i][j]*this.M2[j][i];
j++;
}
j=0;
s=this.M[k][i];
i++;
}
}
}

3-fichier main.cpp:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "Mat.h"
using namespace std;
int main()
{
Mat m;
m.saisie(5);
double debut, fin;
debut = clock();
m.produit(5);
fin = clock();
printf("M1[0][0]=%f",m.M1[0][0]);
printf("temps = %f\n",(debut-fin) );
printf("programme exécuté!");
return 0;
}

1 réponse

fiddy Messages postés 11653 Date d'inscription   Statut Contributeur Dernière intervention   1 847
 
Bonjour,

Je n'ai pas du tout regardé ton programme, mais il s'agit peut-être d'un cas classique sur Windows.
Ajoute l'instruction : system("PAUSE"); juste avant ton return 0; de la fonction main().

Cdlt,
0