Accueil > > > UNE MATRICE CREUSE EN TURBOC
UNE MATRICE CREUSE EN TURBOC
Information sur la source
Description
c'est un prg qui pesente une matrice creuse dans la memoir( matrice creurse +75% =0)
en utilisant les classes
Compilateur TurboC 3.0 sous windows
Source
- #include<dos.h>
- #include<conio.h>
- #include<iostream.h>
- #include<stdlib.h>
-
- class element
- {
- public:
- element(int=1,int=1,int=1);
- int ligne(element*x){return x->lig;}
- int colonne(element*x){return x->col;}
- int valeur(element*x){return x->val;}
- void afctacol_suiv(element *x,element*y){x->col_suiv=y;}
- void afctalig_suiv(element *x,element*y){x->lig_suiv=y;}
- element *rtncol_suiv(element*x){return x->col_suiv;}
- element *rtnlig_suiv(element*x){return x->lig_suiv;}
- void operator delete(void *p){delete p;}
- private:
- int lig,col,val;
- element* col_suiv,*lig_suiv;
- };
-
- class Matrix:public element
- {
- public:
- ~Matrix();
- Matrix(int=0,int=0);
- void afficher();
- void lecture(int,int,int);
- int extraire(int,int);
- Matrix operator+(Matrix);
- Matrix operator*(Matrix);
- private:
- int nbr_col,nbr_lig;
- element *T_col[10],*T_lig[10];
- };
- void alarma()
- {
- unsigned frequence;
- do
- {
- for(frequence=500 ; frequence<=1500; frequence+=50)
- {
- sound(frequence);
- delay(10);
- }
- for(frequence=1500; frequence>=500; frequence-=50)
- {
- sound(frequence);
- delay(10);
- }
- }
- while(! kbhit());
- nosound();
- }
-
- char menu_prince()
- {
- char c;
- textcolor(14);
- clrscr();
- cout<<" MENU PRINCIPAL \n";
- gotoxy(1,10);
- cout<<" 1 )-------- Lecture\n";
- cout<<" 2 )-------- Extraction\n";
- cout<<" 3 )-------- Affichage\n";
- cout<<" 4 )-------- Addition\n";
- cout<<" 5 )-------- Multiplication\n";
- cout<<" 6 )-------- Quitter\n";
- gotoxy(1,10);textcolor(10+BLINK);cprintf(" 1");
- gotoxy(1,11);textcolor(11+BLINK);cprintf(" 2");
- gotoxy(1,12);textcolor(12+BLINK);cprintf(" 3");
- gotoxy(1,13);textcolor(10+BLINK);cprintf(" 4");
- gotoxy(1,14);textcolor(11+BLINK);cprintf(" 5");
- gotoxy(1,15);textcolor(12+BLINK);cprintf(" 6");
- gotoxy(79,24);
- textcolor(14);
- c=getch();
- clrscr();
- return c;
- }
-
- char menu_lecture()
- {
- char c;
- textcolor(14);
- clrscr();
- cout<<" LECTURE \n";
- gotoxy(1,10);
- cout<<"1 )-------- Rempilissage de La Matrix 1 \n";
- cout<<"2 )-------- Rempilissage de La Matrix 2\n";
- cout<<"3 )-------- Retour\n";
- gotoxy(1,10);textcolor(10+BLINK);cprintf("1");
- gotoxy(1,11);textcolor(11+BLINK);cprintf("2");
- gotoxy(1,12);textcolor(12+BLINK);cprintf("3");
- gotoxy(79,24);
- textcolor(14);
- c=getch();
- clrscr();
- return c;
- }
-
- char menu_extraire()
- {
- char c;
- textcolor(14);
- clrscr();
- cout<<" EXTRAIRE \n";
- gotoxy(1,10);
- cout<<"1 )-------- Extaire de La Matrix 1 \n";
- cout<<"2 )-------- Extaire de La Matrix 2\n";
- cout<<"3 )-------- Retour\n";
- gotoxy(1,10);textcolor(10+BLINK);cprintf("1");
- gotoxy(1,11);textcolor(11+BLINK);cprintf("2");
- gotoxy(1,12);textcolor(12+BLINK);cprintf("3");
- gotoxy(79,24);
- textcolor(14);
- c=getch();
- clrscr();
- return c;
- }
-
-
- char menu_affichage()
- {
- char c;
- clrscr();
- cout<<" AFFICHAGE \n";
- gotoxy (1,10);
- cout<<"1 )-------- Afficher La Matrix 1\n";
- cout<<"2 )-------- Afficher La Matrix 2 \n";
- cout<<"3 )-------- Afficher La Matrix Resultat \n";
- cout<<"4 )-------- Retour\n";
- gotoxy(1,10);textcolor(10+BLINK);cprintf("1");
- gotoxy(1,11);textcolor(11+BLINK);cprintf("2");
- gotoxy(1,12);textcolor(11+BLINK);cprintf("3");
- gotoxy(1,13);textcolor(12+BLINK);cprintf("4");
- gotoxy(79,24);
- textcolor(14);
- c=getch();
- clrscr();
- return c;
- }
- /**/
- element::element(int x,int y,int z)
- {
- lig=x;
- col=y;
- val=z;
- col_suiv=NULL;
- lig_suiv=NULL;
- }
- /**/
- Matrix::~Matrix()
- {
- delete(*T_col);
- delete(*T_lig);
- }
- /**/
- Matrix::Matrix(int x, int y)
- { int i;
- char c;
- int init_nbr_col,init_nbr_lig;
- nbr_lig=x;
- nbr_col=y;
- //initialisation du tableau colonne par NULL
- // La partie colonnes
- for(i=1;i<=y;i++)
- T_col[i]=NULL;
- // La partie lignes
- for(i=1;i<=x;i++)
- T_lig[i]=NULL;
- }
- /**/
- void Matrix::afficher()
- {
- element *ptr;
- int i,j,x,y;
- for(j=1;j<=nbr_lig;j++)
- for(i=1;i<=nbr_col;i++)
- {
- gotoxy(i*3,j*3);
- cout<<"0";
- }
- for(i=1;i<=nbr_col;i++)
- {
- ptr=T_col[i];
- while(ptr!=NULL)
- {
- y=ligne(ptr);
- x=colonne(ptr);
- gotoxy(x*3,y*3);
- cout<<valeur(ptr);
- ptr=rtncol_suiv(ptr);
- }
- }
- getch();
- }
- /**/
- int Matrix::extraire(int x,int y)
- { int ind_lig,ind_col;
- element *ptr1,n;
- ptr1=T_col[y];
- if(ptr1)
- {
- ind_lig=n.ligne(ptr1);
- while((ptr1)&&(ind_lig!=x))
- {
- ptr1=n.rtncol_suiv(ptr1);
- ind_lig=n.ligne(ptr1);
- }
- }
- if(ptr1)return n.valeur(ptr1);
- else return 0;
- }
- /**/
- void Matrix::lecture(int lig,int col,int val)
- {
- int ind_col,ind_lig;
- element *ptrn,*ptr1,*ptr2;
- element elem;
- if(lig&&col&&val)//Pour creer un new noeud il faut tester si
- //col!=0 et val!=0 et lig!=0
- {
- ptrn=new element(lig,col,val);
- ptr1=T_col[col];//un attachement
- ptr2=ptr1;//sauvgarde
- if(ptr1)
- {
- ind_lig=elem.ligne(ptr1);
- if(ind_lig>elem.ligne(ptrn))
- {
- T_col[col]=ptrn;
- elem.afctacol_suiv(ptrn,ptr1);
- }
- else
- {
- while((ptr1)&&(ind_lig<(elem.ligne(ptrn))))
- {
- ptr2=ptr1;
- ptr1=elem.rtncol_suiv(ptr1);
- ind_lig=elem.ligne(ptr1);
- }
- if(ind_lig==elem.ligne(ptrn))
- {
- elem.afctacol_suiv(ptrn,elem.rtncol_suiv(ptr1));
- if(ptr1==T_col[col])
- T_col[col]=ptrn;
- else elem.afctacol_suiv(ptr2,ptrn);
- }
- else
- {
- elem.afctacol_suiv(ptrn,elem.rtncol_suiv(ptr2));
- elem.afctacol_suiv(ptr2,ptrn);
- }
- }
- }
- else
- T_col[col]=ptrn;
- ptr1=T_lig[lig];
- ptr2=ptr1;
- if(ptr1)
- {
- ind_col=elem.colonne(ptr1);
- if(ind_col>elem.colonne(ptrn))
- {
- T_lig[lig]=ptrn;
- elem.afctalig_suiv(ptrn,ptr1);
- }
- else
- {
- while((ptr1)&&(ind_col<(elem.colonne(ptrn))))
- {
- ptr2=ptr1;
- ptr1=elem.rtnlig_suiv(ptr1);
- ind_col=elem.colonne(ptr1);
- }
- }
- if(ind_col==elem.colonne(ptrn))
- {
- elem.afctalig_suiv(ptrn,elem.rtncol_suiv(ptr1));
- if(ptr1==T_lig[lig])
- T_lig[lig]=ptrn;
- else elem.afctalig_suiv(ptr2,ptrn);
- }
- else
- {
- elem.afctalig_suiv(ptrn,elem.rtncol_suiv(ptr2));
- elem.afctalig_suiv(ptr2,ptrn);
- }
- }
- else
- T_lig[lig]=ptrn;
- }
- }
- /**/
- Matrix Matrix::operator+(Matrix mat2)
- {
- Matrix m3(nbr_col,nbr_lig);
- int i,j,z,w;
- if((nbr_col==mat2.nbr_col)&&(nbr_lig==mat2.nbr_lig))
- {
- for(i=1;i<=nbr_lig;i++)
- for(j=1;j<=nbr_col;j++)
- {
- z=extraire(i,j);
- w=mat2.extraire(i,j);
- m3.lecture(i,j,z+w);
- }
- }
- return m3;
- }
- /**/
- Matrix Matrix::operator*(Matrix mat2)
- //Matrix multiplication(Matrix m1,Matrix mat2)
- {
- Matrix m3(nbr_lig,nbr_col);
- if(nbr_lig==mat2.nbr_lig)
- {
- int i,j,k,w;
- for(i=1;i<=nbr_lig;i++)
- for(j=1;j<=mat2.nbr_col;j++)
- {
- w=0;
- for(k=1;k<=nbr_col;k++)
- w+=extraire(i,k)*mat2.extraire(k,j);
- m3.lecture(i,j,w);
- }
- }
- else {
- alarma();
- cout<<"Les matrice ne sont pas egaux au niveau de la dimension ";
- delay(2000);nosound();}
- return m3;
- }
- /**/
- void main()
- {
- int s,x,y,z,lig;
- element* ptr;
- int max_lig=3;
- int max_col=3;
- Matrix mat1(max_lig,max_col),mat2(max_lig,max_col),mat3(max_lig,max_col);
- char c='r',rep;
- clrscr();
- while(c!='6')
- {
- rep='r';
- c=menu_prince();
- switch(c)
- {
- case'1':{
- while(rep!='3')
- {
- rep=menu_lecture();
- switch(rep)
- {
- case '1':{ int toto=0;
- cout<<" Remplissage Mat1 \n";
- cout<<" "<<max_lig<<" * "<<max_col<<" \n";
- gotoxy(5,3+toto);
- cout<<"LIGNES";
- gotoxy(25,3+toto);
- cout<<"COLONNES";
- gotoxy(45,3+toto);
- cout<<"VALEURS";
- while(s)
- {
- gotoxy(5,6+toto);
- cin>>x;
- if(x&&x<=max_lig)
- {
- gotoxy(25,6+toto);
- cin>>y;
- if(!y||y>max_col)
- {
- alarma();
- break;
- }
- gotoxy(45,6+toto);
- cin>>z;
- mat1.lecture(x,y,z);
- toto++;
- }
- else
- {
- alarma();
- s=0;
-
- }
- }
- s=1;
- break;
- }
-
- case'2':{
- cout<<" Remplissage Mat2 \n";
- cout<<" "<<max_lig<<" * "<<max_col<<" \n";
-
- int toto=0;gotoxy(5,2+toto);
- cout<<"LIGNES";
- gotoxy(25,2+toto);
- cout<<"COLONNES";
- gotoxy(45,2+toto);
- cout<<"VALEURS";
- while(s)
- {
- gotoxy(5,6+toto);
- cin>>x;
- if(x&&x<=max_lig)
- {
- gotoxy(25,6+toto);
- cin>>y;
- if(!y||y>max_col)
- {
- alarma();
- break;
- }
- gotoxy(45,6+toto);
- cin>>z;
- mat2.lecture(x,y,z);
- toto++;
- }
- else
- {
- alarma();
- s=0;
- }
- }
- break;}
- }
- }
- break;
- }
- case '2':{
- rep=menu_extraire();
- cout<<" EXTRAIRE ELEMENT \n";
- cout<<" "<<max_lig<<" * "<<max_col<<" \n";
- switch (rep)
- {
- case '1':
- {
- int toto=0;gotoxy(5,2+toto);
- cout<<"LIGNES";
- gotoxy(25,2+toto);
- cout<<"COLONNES";
- gotoxy(45,2+toto);
- cout<<"VALEURS";
- s=1;
- while(s)
- {
- gotoxy(5,6+toto);
- cin>>x;
- if(x&&x<=max_lig)
- {
- gotoxy(25,6+toto);
- cin>>y;
- if(!y||y>max_col)
- {
- alarma();
- break;
- }
- else
- {
- gotoxy(45,6+toto);
- cout<<mat1.extraire(x,y);
- }
- toto++;
- }
- else
- {
- alarma();
- s=0;
- }
- }
- }
- break;
- case '2':
- {
- int toto=0;gotoxy(5,2+toto);
- cout<<"LIGNES";
- gotoxy(25,2+toto);
- cout<<"COLONNES";
- gotoxy(45,2+toto);
- cout<<"VALEURS";
- s=1;
- while(s)
- {
- gotoxy(5,6+toto);
- cin>>x;
- if(x&&x<=max_lig)
- {
- gotoxy(25,6+toto);
- cin>>y;
- if(!y||y>max_col)
- {
- alarma();
- break;
- }
- else
- {
- gotoxy(45,6+toto);
- cout<<mat2.extraire(x,y);
- }
- toto++;
- }
- else
- {
- alarma();
- s=0;
- }
- }
- }
- break;
- }
- break;
- }
- case'3':{
- while(rep!='4')
- {
- rep=menu_affichage();
- switch(rep)
- {
- case'1':{mat1.afficher();
- break;}
- case'2':{mat2.afficher();
- break;}
- }
- }
- break;
- }
- case'4':{//Addition
- mat3=mat1+mat2;
- mat3.afficher();
- break;
- }
- case'5':{
- //Multiplication
- mat3=mat1*mat2;
- mat3.afficher();
- break;
- }
- case '6':{
- exit(0);
- }
- }
- }
- }
#include<dos.h>
#include<conio.h>
#include<iostream.h>
#include<stdlib.h>
class element
{
public:
element(int=1,int=1,int=1);
int ligne(element*x){return x->lig;}
int colonne(element*x){return x->col;}
int valeur(element*x){return x->val;}
void afctacol_suiv(element *x,element*y){x->col_suiv=y;}
void afctalig_suiv(element *x,element*y){x->lig_suiv=y;}
element *rtncol_suiv(element*x){return x->col_suiv;}
element *rtnlig_suiv(element*x){return x->lig_suiv;}
void operator delete(void *p){delete p;}
private:
int lig,col,val;
element* col_suiv,*lig_suiv;
};
class Matrix:public element
{
public:
~Matrix();
Matrix(int=0,int=0);
void afficher();
void lecture(int,int,int);
int extraire(int,int);
Matrix operator+(Matrix);
Matrix operator*(Matrix);
private:
int nbr_col,nbr_lig;
element *T_col[10],*T_lig[10];
};
void alarma()
{
unsigned frequence;
do
{
for(frequence=500 ; frequence<=1500; frequence+=50)
{
sound(frequence);
delay(10);
}
for(frequence=1500; frequence>=500; frequence-=50)
{
sound(frequence);
delay(10);
}
}
while(! kbhit());
nosound();
}
char menu_prince()
{
char c;
textcolor(14);
clrscr();
cout<<" MENU PRINCIPAL \n";
gotoxy(1,10);
cout<<" 1 )-------- Lecture\n";
cout<<" 2 )-------- Extraction\n";
cout<<" 3 )-------- Affichage\n";
cout<<" 4 )-------- Addition\n";
cout<<" 5 )-------- Multiplication\n";
cout<<" 6 )-------- Quitter\n";
gotoxy(1,10);textcolor(10+BLINK);cprintf(" 1");
gotoxy(1,11);textcolor(11+BLINK);cprintf(" 2");
gotoxy(1,12);textcolor(12+BLINK);cprintf(" 3");
gotoxy(1,13);textcolor(10+BLINK);cprintf(" 4");
gotoxy(1,14);textcolor(11+BLINK);cprintf(" 5");
gotoxy(1,15);textcolor(12+BLINK);cprintf(" 6");
gotoxy(79,24);
textcolor(14);
c=getch();
clrscr();
return c;
}
char menu_lecture()
{
char c;
textcolor(14);
clrscr();
cout<<" LECTURE \n";
gotoxy(1,10);
cout<<"1 )-------- Rempilissage de La Matrix 1 \n";
cout<<"2 )-------- Rempilissage de La Matrix 2\n";
cout<<"3 )-------- Retour\n";
gotoxy(1,10);textcolor(10+BLINK);cprintf("1");
gotoxy(1,11);textcolor(11+BLINK);cprintf("2");
gotoxy(1,12);textcolor(12+BLINK);cprintf("3");
gotoxy(79,24);
textcolor(14);
c=getch();
clrscr();
return c;
}
char menu_extraire()
{
char c;
textcolor(14);
clrscr();
cout<<" EXTRAIRE \n";
gotoxy(1,10);
cout<<"1 )-------- Extaire de La Matrix 1 \n";
cout<<"2 )-------- Extaire de La Matrix 2\n";
cout<<"3 )-------- Retour\n";
gotoxy(1,10);textcolor(10+BLINK);cprintf("1");
gotoxy(1,11);textcolor(11+BLINK);cprintf("2");
gotoxy(1,12);textcolor(12+BLINK);cprintf("3");
gotoxy(79,24);
textcolor(14);
c=getch();
clrscr();
return c;
}
char menu_affichage()
{
char c;
clrscr();
cout<<" AFFICHAGE \n";
gotoxy (1,10);
cout<<"1 )-------- Afficher La Matrix 1\n";
cout<<"2 )-------- Afficher La Matrix 2 \n";
cout<<"3 )-------- Afficher La Matrix Resultat \n";
cout<<"4 )-------- Retour\n";
gotoxy(1,10);textcolor(10+BLINK);cprintf("1");
gotoxy(1,11);textcolor(11+BLINK);cprintf("2");
gotoxy(1,12);textcolor(11+BLINK);cprintf("3");
gotoxy(1,13);textcolor(12+BLINK);cprintf("4");
gotoxy(79,24);
textcolor(14);
c=getch();
clrscr();
return c;
}
/**/
element::element(int x,int y,int z)
{
lig=x;
col=y;
val=z;
col_suiv=NULL;
lig_suiv=NULL;
}
/**/
Matrix::~Matrix()
{
delete(*T_col);
delete(*T_lig);
}
/**/
Matrix::Matrix(int x, int y)
{ int i;
char c;
int init_nbr_col,init_nbr_lig;
nbr_lig=x;
nbr_col=y;
//initialisation du tableau colonne par NULL
// La partie colonnes
for(i=1;i<=y;i++)
T_col[i]=NULL;
// La partie lignes
for(i=1;i<=x;i++)
T_lig[i]=NULL;
}
/**/
void Matrix::afficher()
{
element *ptr;
int i,j,x,y;
for(j=1;j<=nbr_lig;j++)
for(i=1;i<=nbr_col;i++)
{
gotoxy(i*3,j*3);
cout<<"0";
}
for(i=1;i<=nbr_col;i++)
{
ptr=T_col[i];
while(ptr!=NULL)
{
y=ligne(ptr);
x=colonne(ptr);
gotoxy(x*3,y*3);
cout<<valeur(ptr);
ptr=rtncol_suiv(ptr);
}
}
getch();
}
/**/
int Matrix::extraire(int x,int y)
{ int ind_lig,ind_col;
element *ptr1,n;
ptr1=T_col[y];
if(ptr1)
{
ind_lig=n.ligne(ptr1);
while((ptr1)&&(ind_lig!=x))
{
ptr1=n.rtncol_suiv(ptr1);
ind_lig=n.ligne(ptr1);
}
}
if(ptr1)return n.valeur(ptr1);
else return 0;
}
/**/
void Matrix::lecture(int lig,int col,int val)
{
int ind_col,ind_lig;
element *ptrn,*ptr1,*ptr2;
element elem;
if(lig&&col&&val)//Pour creer un new noeud il faut tester si
//col!=0 et val!=0 et lig!=0
{
ptrn=new element(lig,col,val);
ptr1=T_col[col];//un attachement
ptr2=ptr1;//sauvgarde
if(ptr1)
{
ind_lig=elem.ligne(ptr1);
if(ind_lig>elem.ligne(ptrn))
{
T_col[col]=ptrn;
elem.afctacol_suiv(ptrn,ptr1);
}
else
{
while((ptr1)&&(ind_lig<(elem.ligne(ptrn))))
{
ptr2=ptr1;
ptr1=elem.rtncol_suiv(ptr1);
ind_lig=elem.ligne(ptr1);
}
if(ind_lig==elem.ligne(ptrn))
{
elem.afctacol_suiv(ptrn,elem.rtncol_suiv(ptr1));
if(ptr1==T_col[col])
T_col[col]=ptrn;
else elem.afctacol_suiv(ptr2,ptrn);
}
else
{
elem.afctacol_suiv(ptrn,elem.rtncol_suiv(ptr2));
elem.afctacol_suiv(ptr2,ptrn);
}
}
}
else
T_col[col]=ptrn;
ptr1=T_lig[lig];
ptr2=ptr1;
if(ptr1)
{
ind_col=elem.colonne(ptr1);
if(ind_col>elem.colonne(ptrn))
{
T_lig[lig]=ptrn;
elem.afctalig_suiv(ptrn,ptr1);
}
else
{
while((ptr1)&&(ind_col<(elem.colonne(ptrn))))
{
ptr2=ptr1;
ptr1=elem.rtnlig_suiv(ptr1);
ind_col=elem.colonne(ptr1);
}
}
if(ind_col==elem.colonne(ptrn))
{
elem.afctalig_suiv(ptrn,elem.rtncol_suiv(ptr1));
if(ptr1==T_lig[lig])
T_lig[lig]=ptrn;
else elem.afctalig_suiv(ptr2,ptrn);
}
else
{
elem.afctalig_suiv(ptrn,elem.rtncol_suiv(ptr2));
elem.afctalig_suiv(ptr2,ptrn);
}
}
else
T_lig[lig]=ptrn;
}
}
/**/
Matrix Matrix::operator+(Matrix mat2)
{
Matrix m3(nbr_col,nbr_lig);
int i,j,z,w;
if((nbr_col==mat2.nbr_col)&&(nbr_lig==mat2.nbr_lig))
{
for(i=1;i<=nbr_lig;i++)
for(j=1;j<=nbr_col;j++)
{
z=extraire(i,j);
w=mat2.extraire(i,j);
m3.lecture(i,j,z+w);
}
}
return m3;
}
/**/
Matrix Matrix::operator*(Matrix mat2)
//Matrix multiplication(Matrix m1,Matrix mat2)
{
Matrix m3(nbr_lig,nbr_col);
if(nbr_lig==mat2.nbr_lig)
{
int i,j,k,w;
for(i=1;i<=nbr_lig;i++)
for(j=1;j<=mat2.nbr_col;j++)
{
w=0;
for(k=1;k<=nbr_col;k++)
w+=extraire(i,k)*mat2.extraire(k,j);
m3.lecture(i,j,w);
}
}
else {
alarma();
cout<<"Les matrice ne sont pas egaux au niveau de la dimension ";
delay(2000);nosound();}
return m3;
}
/**/
void main()
{
int s,x,y,z,lig;
element* ptr;
int max_lig=3;
int max_col=3;
Matrix mat1(max_lig,max_col),mat2(max_lig,max_col),mat3(max_lig,max_col);
char c='r',rep;
clrscr();
while(c!='6')
{
rep='r';
c=menu_prince();
switch(c)
{
case'1':{
while(rep!='3')
{
rep=menu_lecture();
switch(rep)
{
case '1':{ int toto=0;
cout<<" Remplissage Mat1 \n";
cout<<" "<<max_lig<<" * "<<max_col<<" \n";
gotoxy(5,3+toto);
cout<<"LIGNES";
gotoxy(25,3+toto);
cout<<"COLONNES";
gotoxy(45,3+toto);
cout<<"VALEURS";
while(s)
{
gotoxy(5,6+toto);
cin>>x;
if(x&&x<=max_lig)
{
gotoxy(25,6+toto);
cin>>y;
if(!y||y>max_col)
{
alarma();
break;
}
gotoxy(45,6+toto);
cin>>z;
mat1.lecture(x,y,z);
toto++;
}
else
{
alarma();
s=0;
}
}
s=1;
break;
}
case'2':{
cout<<" Remplissage Mat2 \n";
cout<<" "<<max_lig<<" * "<<max_col<<" \n";
int toto=0;gotoxy(5,2+toto);
cout<<"LIGNES";
gotoxy(25,2+toto);
cout<<"COLONNES";
gotoxy(45,2+toto);
cout<<"VALEURS";
while(s)
{
gotoxy(5,6+toto);
cin>>x;
if(x&&x<=max_lig)
{
gotoxy(25,6+toto);
cin>>y;
if(!y||y>max_col)
{
alarma();
break;
}
gotoxy(45,6+toto);
cin>>z;
mat2.lecture(x,y,z);
toto++;
}
else
{
alarma();
s=0;
}
}
break;}
}
}
break;
}
case '2':{
rep=menu_extraire();
cout<<" EXTRAIRE ELEMENT \n";
cout<<" "<<max_lig<<" * "<<max_col<<" \n";
switch (rep)
{
case '1':
{
int toto=0;gotoxy(5,2+toto);
cout<<"LIGNES";
gotoxy(25,2+toto);
cout<<"COLONNES";
gotoxy(45,2+toto);
cout<<"VALEURS";
s=1;
while(s)
{
gotoxy(5,6+toto);
cin>>x;
if(x&&x<=max_lig)
{
gotoxy(25,6+toto);
cin>>y;
if(!y||y>max_col)
{
alarma();
break;
}
else
{
gotoxy(45,6+toto);
cout<<mat1.extraire(x,y);
}
toto++;
}
else
{
alarma();
s=0;
}
}
}
break;
case '2':
{
int toto=0;gotoxy(5,2+toto);
cout<<"LIGNES";
gotoxy(25,2+toto);
cout<<"COLONNES";
gotoxy(45,2+toto);
cout<<"VALEURS";
s=1;
while(s)
{
gotoxy(5,6+toto);
cin>>x;
if(x&&x<=max_lig)
{
gotoxy(25,6+toto);
cin>>y;
if(!y||y>max_col)
{
alarma();
break;
}
else
{
gotoxy(45,6+toto);
cout<<mat2.extraire(x,y);
}
toto++;
}
else
{
alarma();
s=0;
}
}
}
break;
}
break;
}
case'3':{
while(rep!='4')
{
rep=menu_affichage();
switch(rep)
{
case'1':{mat1.afficher();
break;}
case'2':{mat2.afficher();
break;}
}
}
break;
}
case'4':{//Addition
mat3=mat1+mat2;
mat3.afficher();
break;
}
case'5':{
//Multiplication
mat3=mat1*mat2;
mat3.afficher();
break;
}
case '6':{
exit(0);
}
}
}
}
Historique
- 05 décembre 2007 08:37:26 :
- Mise a jour du titre et de la description
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
SESSION SILVERLIGHT 5 3D : SLIDES ET DEMOSSESSION SILVERLIGHT 5 3D : SLIDES ET DEMOS par Groc
Durant les techdays, j'ai eu le plaisir d'animer une session sur Silverlight 5 et la 3D avec Simon Ferquel. Comme promis, voici nos slides et mes démos (celles avec le viper BSG) ici et là. Pour mémoire, les démos utilisent toutes le viper BSG...
Cliquez pour lire la suite de l'article par Groc [TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES[TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES par gpommier
Suite à la session que j'ai présenté sur WebMatrix 2, vous pouvez trouver les slides ici, ainsi que les démos en packages nuget : démos1 et démos2 J'en profite pour remercier chaleureusement tous ceux qui sont venus très nombreux à cette sess...
Cliquez pour lire la suite de l'article par gpommier [SHAREPOINT] LES SESSIONS TECHDAYS 2012.[SHAREPOINT] LES SESSIONS TECHDAYS 2012. par Patrick Guimonet
Voici donc pour ceux qui n'ont pas pu venir, ou ceux qui n'ont pas pu toutes les suivre la liste des sessions SharePoint aux TechDays 2012, que je mettrais à jour dès que les liens des vidéo seront disponibles. Ou ici : http...
Cliquez pour lire la suite de l'article par Patrick Guimonet TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3 par ROMELARD Fabrice
Speaker: Bernard Ourghanlian Cette session est comme chaque jour transmise en live par BrainSonic, et j'ai donc suivi cette troisième pleinière par ce moyen sur mon iPad . Elle est dédiée comme chaque année à la mise en perspective de l'é...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE !MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE ! par Vko
Hier durant une session dédiée aux Techdays 2012, j'ai eu le plaisir d'annoncer la sortie de la Béta 2 de Mishra Reader. C'est quoi ? Pour les utilisateurs, c'est une vraie expérience de lecture de flux RSS sur Windows. Rien à voir avec les produit...
Cliquez pour lire la suite de l'article par Vko
Logiciels
Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning
|