Accueil > > > LA RESOLUTION D'UN SYSTEM AVEC LA METHODE DE GAUSSE ET NEWTON[TURBO C++]
LA RESOLUTION D'UN SYSTEM AVEC LA METHODE DE GAUSSE ET NEWTON[TURBO C++]
Information sur la source
Description
C'ete un Tp pour ulistrer le cours des maths :) J'attend cos sugestions ;)
Source
- #include <graphics.h>
- #include <ctype.h>
- #include <stream.h>
- #include <time.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <conio.h>
- #include <dos.h>
- #include <string.h>
- union REGS reg;
-
- void initm()
- {
- reg.x.ax=0x00;
- int86(0x33,®,®);
- }
-
- void mouse_on(void)
- {
- reg.x.ax=0x01;
- int86(0x33,®,®);
- }
-
- void mouse_off(void)
- {
- reg.x.ax=0x02;
- int86(0x33,®,®);
- }
-
- int Xm(void)
- {
- reg.x.ax=0x03;
- int86(0x33,®,®);
- return(reg.x.cx);
- }
-
- int Ym(void)
- {
- reg.x.ax=0x03;
- int86(0x33,®,®);
- return(reg.x.dx);
- }
-
- int in_rec(int a,int b,int c,int d)
- {
- if ( ( Xm()<c ) && ( Xm()>a ) && ( Ym()<d ) && ( Ym()>b ) )
- return(1);
- else
- return(0);
- }
-
- int etat(void)
- {
- reg.x.ax=0x03;
- int86(0x33,®,®);
- return(reg.x.bx);
- }
-
- /*void BOUTON(int x,int y,int dx,int dy,int col)
- { int i;
- setfillstyle(1,col);
- bar(x,y,dx,dy);
- setcolor(15);
- line(x+1,y+1,dx-1,y+1);
- line(x+1,y+1,x+1,dy-1);
- setcolor(0);
- line(x,dy,dx,dy);
- line(dx,y,dx,dy);
- setcolor(8);
- line(x+1,dy-1,dx-1,dy-1);
- line(dx-1,y+1,dx-1,dy-1);
- }*/
-
- void boutton(int x,int y,int z,int w,int c1,int c2,int c3)
- {
- setfillstyle(SOLID_FILL, c3) ; bar(x,y,z,w) ;
- setcolor(c1) ; line(x,y,z,y) ; line(x,y,x,w) ;
- setcolor(c2) ; line(x,w,z,w) ; line(z,y,z,w) ;
- }
-
- void boutton2(int x,int y,int z,int w,int c1,int c2,int c3)
- {
- setfillstyle(INTERLEAVE_FILL, c3) ; bar(x,y,z,w) ;
- setcolor(c1) ; line(x,y,z,y) ; line(x,y,x,w) ;
- setcolor(c2) ; line(x,w,z,w) ; line(z,y,z,w) ;
- }
-
- void boutton3(int x,int y,int z,int w,int c1,int c2)
- {
- setcolor(c1) ; line(x,y,z,y) ; line(x,y,x,w) ;
- setcolor(c2) ; line(x,w,z,w) ; line(z,y,z,w) ;
- }
-
- void btn1(int x,int y,int z,int w)
- {
- setfillstyle(SOLID_FILL, 7) ; bar(x+2,y+2,z-2,w-2) ;
- setcolor(15) ; line(x+1,y+1,z-2,y+1) ; line(x+1,y+1,x+1,w-2) ;
- setcolor(7) ; line(x,y,z-1,y) ; line(x,y,x,w-1) ;
-
- setcolor(8) ; line(z-1,y+1,z-1,w-1) ; line(x+1,w-1,z-1,w-1) ;
- setcolor(0) ; line(z,y,z,w) ; line(x,w,z,w) ;
-
- }
-
- void btn2(int x,int y,int z,int w)
- {
- setcolor(15);rectangle(x,y,z,w);
- rectangle(x+1,y+1,z,w);
- setcolor(8);rectangle(x,y,z-1,w-1);
- }
-
- void btn3(int x,int y,int z,int w)
- {
- setcolor(15) ; line(z,y,z,w) ; line(x,w,z,w) ;
-
- setcolor(8) ; line(x,y,z-1,y) ; line(x,y,x,w-1) ;
-
- }
-
- void boutton4(int x,int y,int z,int w)
- {
- boutton3(x,y,z,w,8,15);
- boutton(x+1,y+1,z-1,w-1,0,7,15);
- }
-
-
- void fleche(int y,int z,int w)
- {
- int abc;
- abc=(y+w)/2;
- mouse_off();
- setcolor(0);
- line(z-13,abc-2,z-7,abc-2);
- line(z-12,abc-1,z-8,abc-1);
- line(z-11,abc,z-9,abc);
- line(z-10,abc+1,z-10,abc+1);
- mouse_on();
- }
-
- void btn(int y,int z,int w)
- {
- mouse_off();
- setfillstyle(1,7);
- bar(z-15,y+4,z-4,w-4);
-
- setcolor(8);
- line(z-3,y+3,z-3,w-3);
- line(z-16,w-3,z-3,w-3);
-
- setcolor(15);
- line(z-16,y+3,z-4,y+3);
- line(z-16,y+3,z-16,w-4);
-
- setcolor(7);
- line(z-17,y+2,z-3,y+2);
- line(z-17,y+2,z-17,w-3);
-
- setcolor(0);
- line(z-2,y+1,z-2,w-2);
- line(z-17,w-2,z-2,w-2);
-
- mouse_on();
-
- }
-
- void fermer(int x,int y,int z,int w)
- {
- setfillstyle(1,7);
- bar(x+2,y+2,z,w);
- setcolor(0);
- rectangle(x+1,y+1,z-1,w-1);
- setcolor(8);
- rectangle(x,y,z-1,w-1);
-
- setcolor(15);
- rectangle(x+1,y+1,z,w);
- setcolor(8);
- rectangle(x,y,z,w);
- setcolor(0);
- line(x+5,y+4,z-5,w-5);
- line(x+5,y+5,z-5,w-4);
- line(x+5,w-5,z-5,y+4);
- line(x+5,w-4,z-5,y+5);
- }
-
- void boutton5(int x,int y,int z,int w)
- {
- mouse_off();
- setfillstyle(1,15);
- bar(x,y,z,w);
-
- setcolor(8);
- line(x,y,z-1,y);
- line(x,y,x,w-1);
-
- setcolor(15);
- line(x,w,z,w);
- line(z,y,z,w);
-
- setcolor(7);
- line(x+1,w-1,z-1,w-1);
- line(z-1,y+1,z-1,w-1);
-
- setcolor(0);
- line(x+1,y+1,z-2,y+1);
- line(x+1,y+1,x+1,w-2);
- btn(y,z,w);
- fleche(y,z,w);
- mouse_on();
- }
-
- void Couleurs()
- {
- setpalette(6,9);
- setpalette(10,36);
- setpalette(11,38);
- setpalette(14,45);
- setpalette(2,32);
- setpalette(9,8);
- }
-
- void listederoul(int x,int y,int z,int w,int c1)
- {
- int i;
- mouse_off();
- for(i=y;i<w;i++)
- {
- setcolor(0);
- rectangle(x,y,z,i);
- setfillstyle(1,c1);
- bar(x+1,y+1,z-1,i-1);
- if(i<=y+9)
- delay(7);
- if(i>=y+10 && i<y+18)
- delay(5);
- else
- delay(2);
- }
- settextstyle(SMALL_FONT,0,4);
- setcolor(9);
- outtextxy(x+5,y+2,"FACTORISATION");
- outtextxy(x+5,y+15,"METHODE DE NEWTON");
- mouse_on();
- }
-
- void ChoixListeDeroul(int x,int y,int z,int w,int k)
- {
- mouse_off();
- setfillstyle(1,15);
- bar(x+1,y+1,z-1,w-1);
- settextstyle(SMALL_FONT,0,4);
- setcolor(9);
- outtextxy(x+5,y+2,"FACTORISATION");
- outtextxy(x+5,y+15,"METHODE DE NEWTON");
-
- switch(k)
- {
- case 1 : setcolor(15);setfillstyle(1,4);
- bar(x+3,y+2,z-3,y+14); outtextxy(x+5,y+2,"FACTORISATION");
- break;
- case 2 : setcolor(15);setfillstyle(1,4);
- bar(x+3,y+15,z-3,y+27); outtextxy(x+5,y+15,"METHODE DE NEWTON");
- break;
- }
- mouse_on();
- }
-
- char *Resultat(int k)
- {
- char *p;
- p = (char *)malloc(sizeof(p)) ;
- mouse_off();
- boutton5(230,170,435,192);
- mouse_on();
- settextstyle(SMALL_FONT,0,4);
- setfillstyle(1,15);setcolor(9);
- switch (k)
- {
- case 1 :bar(233,173,416,189);
- strcpy(p,"FACTORISATION");
- setcolor(9) ;outtextxy(235,174,"FACTORISATION");
- break;
- case 2 :bar(233,173,416,189);
- strcpy(p,"METHODE DE NEWTON");
- setcolor(9) ; outtextxy(235,174,"METHODE DE NEWTON");
- break;
- }
-
- return p;
- }
-
-
- void Effacer()
- {
- boutton(80,160,170,371,0,15,8);
- setcolor(15) ;
- outtextxy(100,182,"METHODES") ;
- boutton(98,194,148,194,15,15,15) ;
- outtextxy(95,233,"PARAMETRES") ;
- boutton(92,245,155,245,15,15,15) ;
- outtextxy(97,284,"RESULTATS") ;
- boutton(94,296,152,296,15,15,15) ;
- outtextxy(102,336,"EFFACER") ;
- boutton(98,348,147,348,15,15,15) ;
- boutton(81,385,489,405,15,0,7);
- }
-
- void Interface()
- {
- setpalette(4,29);
- setpalette(9,8) ;
- settextstyle(SMALL_FONT,0,4);
- setfillstyle(10,1);
- bar(0,0,645,480);
- boutton(60,80,580,420,15,15,7);
- boutton(61,80,579,419,15,15,7);
- boutton(63,83,577,103,8,8,8);
- boutton(80,110,318,130,0,15,7);
- boutton(81,111,159,129,15,0,7);
- boutton(160,111,238,129,15,0,7);
- boutton(239,111,317,129,15,0,7);
- setcolor(9) ;
- outtextxy(95,115,"A PROPOS") ;
- outtextxy(175,115,"METHODES") ;
- outtextxy(258,115,"QUITTER") ;
- fermer(556,85,571,101);
- setcolor(15) ; outtextxy(70,88,"ANALYSE NUMERIQUE ... TP2") ;
- Effacer() ;
- boutton4(200,160,560,370) ;
- boutton(80,384,560,406,0,15,7);
- boutton(81,385,489,405,15,0,7);
- outtextxy(300,390,"Commandes : ") ;
- }
-
- void Date(int x , int y)
- {
- struct date D ;
- getdate(&D);
- char CH[6] ;
- setpalette(6,5);
- setcolor(6);
- sprintf(CH,"%d",D.da_day) ; outtextxy(x,y,CH) ;
- sprintf(CH,"%d",D.da_mon) ; outtextxy(x+15,y,CH) ;
- sprintf(CH,"%d",D.da_year) ; outtextxy(x+30,y,CH) ;
- }
-
- void Time(int x , int y)
- {
- struct time t;
- static char s[10];
- static sec=0;
- gettime(&t);
- if ( sec != t.ti_sec )
- {
- setcolor(7);
- boutton(490,385,559,405,15,0,7);
- outtextxy(x,y,s);
- sprintf(s," %2d:%02d:%02d",t.ti_hour, t.ti_min, t.ti_sec);
- setcolor(1);
- boutton(490,385,559,405,15,0,7);
- outtextxy(x,y,s);
- sec=t.ti_sec;
- }
- }
-
- void ChoixMenu(int k)
- {
- setpalette(5,32) ;
- switch(k)
- {
- case 1 : Effacer() ; boutton(81,161,169,212,15,0,7);
- outtextxy(100,182,"METHODES") ; setcolor(5) ;
- outtextxy(93,390,"Le Choix Du M,thodes") ;
- break ;
- case 2 : Effacer() ; boutton(81,213,169,266,15,0,7);
- outtextxy(95,233,"PARAMETRES") ; setcolor(5) ;
- outtextxy(93,390,"La Saisie Des Param¦tres") ;
- break ;
- case 3 : Effacer() ; boutton(81,267,169,319,15,0,7);
- outtextxy(100,284,"RESULTATS") ; setcolor(5) ;
- outtextxy(93,390,"La Solution Du Systeme Ou De L'Equation") ;
- break ;
- case 4 : Effacer() ; boutton(81,320,169,370,15,0,7);
- outtextxy(100,336,"EFFACER") ; setcolor(5) ;
- outtextxy(93,390,"Effacer") ;
- break ;
- }
- }
-
- void MenuMethode()
- {
- boutton(160,132,310,204,15,0,7);
- boutton(165,135,185,199,8,8,8);
- setcolor(7);
- settextstyle(SMALL_FONT,1,4);
- outtextxy(169,144,"METHODES");
- settextstyle(SMALL_FONT,0,4);
- setcolor(15);
- outtextxy(196,142,"Factorisation");
- outtextxy(196,162,"M,thode De GAUSS");
- outtextxy(196,182,"M,thode De NEWTON");
- }
-
- void EffaceMenuMethode()
- {
- boutton(190,139,300,198,7,7,7) ;
- settextstyle(SMALL_FONT,0,4);
- setcolor(15);
- outtextxy(196,142,"Factorisation");
- outtextxy(196,162,"M,thode De GAUSS");
- outtextxy(196,182,"M,thode De NEWTON");
- }
-
- void ChoixMethode(int k)
- {
- switch(k)
- {
- case 1 : EffaceMenuMethode() ; boutton(191,139,300,157,8,8,8) ;
- setcolor(15) ; outtextxy(196,142,"Factorisation");
- break ;
- case 2 : EffaceMenuMethode() ;boutton(191,159,300,177,8,8,8) ;
- setcolor(15) ; outtextxy(196,162,"M,thode De GAUSS");
- break ;
- case 3 : EffaceMenuMethode() ;boutton(191,179,300,197,8,8,8) ;
- setcolor(15) ; outtextxy(196,182,"M,thode De NEWTON");
- break ;
- }
- }
-
- void Efface2()
- {
- boutton(70,131,570,372,7,7,7);
- boutton4(200,160,560,370) ;
- Effacer() ;
- }
-
- void Titre(char Ch[])
- {
- int i ;
- settextstyle(TRIPLEX_FONT,0,3) ;
- for ( i=0 ; i<5 ; i++ )
- {
- setcolor(0) ;
- outtextxy(380-i,120+i,Ch) ;
- }
- setcolor(15) ;
- outtextxy(380-i,120+i,Ch) ;
- settextstyle(SMALL_FONT,0,4) ;
- }
-
- int Methode()
- {
- int k=0 , L=0 ;
- char P ;
- MenuMethode() ;
- while (k!=5)
- {
- Date(490,165) ;
- while ( Time(495,390) , !kbhit()) ;
- P=getch();
- switch(P)
- {
- case 80 : k++; if(k>3) k=1; ChoixMethode(k);
- break;
- case 72 : k--; if(k<1) k=3; ChoixMethode(k);
- break ;
- case 13 : switch(k)
- {
- case 1 : L = 1 ; k = 5 ; Efface2();
- Titre("FACTORISATION") ;break ;
- case 2 : L = 2 ; k = 5 ; Efface2() ;
- Titre("M . GAUSS") ; break ;
- case 3 : L = 3 ; k = 5 ; Efface2() ;
- Titre("M . NEWTON") ; break ;
- }
- break ;
- case 27 :
- case 75 :
- case 77 : k = 5 ; break ;
- }
- }
- return L ;
- }
-
- void EffaceMenu_P()
- {
- boutton(81,111,159,129,15,0,7);
- boutton(160,111,238,129,15,0,7);
- boutton(239,111,317,129,15,0,7);
- setcolor(9) ;
- outtextxy(95,115,"A PROPOS") ;
- outtextxy(175,115,"METHODES") ;
- outtextxy(258,115,"QUITTER") ;
- }
-
- void ChoixMenu_P(int k)
- {
- switch(k)
- {
- case 1 : EffaceMenu_P() ; boutton(81,111,159,129,0,15,7);
- outtextxy(95,115,"A PROPOS") ;
- break ;
- case 2 : EffaceMenu_P() ; boutton(160,111,238,129,0,15,7);
- outtextxy(175,115,"METHODES") ;
- break ;
- case 3 : EffaceMenu_P() ; boutton(239,111,317,129,0,15,7);
- outtextxy(258,115,"QUITTER") ;
- break ;
- }
- }
-
- int Menu_P()
- {
- int k=0 , L ;
- char P ;
- while (k!=5)
- {
- Date(490,165) ;
- while ( Time(495,390) , !kbhit() ) ;
- P=getch();
- switch(P)
- {
- case 77 : k++; if(k>3) k=1; ChoixMenu_P(k);
- break;
- case 75 : k--; if(k<1) k=3; ChoixMenu_P(k);
- break ;
- case 13 : switch(k)
- {
- case 2 : L = Methode() ; k=5 ; break ;
- case 3 : k=5 ; break ;
- }
- break ;
- case 27 : k = 5 ;
- break ;
- }
- }
- return L ;
- }
-
- void main()
- {
- int E = DETECT , F ;
- initgraph(&E,&F,"C:\\Tc") ;
- int k=0 , L ;
- char P ;
- initm() ;
- Interface() ;
- L = Menu_P() ;
- if ( L == 1 || L == 2 || L == 3 )
- {
- while (k!=5)
- {
- Date(490,165) ;
- while ( Time(495,390) , !kbhit() ) ;
- P=getch();
- switch(P)
- {
- case 80 : k++; if(k>4) k=1; ChoixMenu(k);
- break;
- case 72 : k--; if(k<1) k=4; ChoixMenu(k);
- break ;
- case 27 : k = 5 ;
- break ;
- }
- }
- }
- closegraph() ;
- }
-
#include <graphics.h>
#include <ctype.h>
#include <stream.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <string.h>
union REGS reg;
void initm()
{
reg.x.ax=0x00;
int86(0x33,®,®);
}
void mouse_on(void)
{
reg.x.ax=0x01;
int86(0x33,®,®);
}
void mouse_off(void)
{
reg.x.ax=0x02;
int86(0x33,®,®);
}
int Xm(void)
{
reg.x.ax=0x03;
int86(0x33,®,®);
return(reg.x.cx);
}
int Ym(void)
{
reg.x.ax=0x03;
int86(0x33,®,®);
return(reg.x.dx);
}
int in_rec(int a,int b,int c,int d)
{
if ( ( Xm()<c ) && ( Xm()>a ) && ( Ym()<d ) && ( Ym()>b ) )
return(1);
else
return(0);
}
int etat(void)
{
reg.x.ax=0x03;
int86(0x33,®,®);
return(reg.x.bx);
}
/*void BOUTON(int x,int y,int dx,int dy,int col)
{ int i;
setfillstyle(1,col);
bar(x,y,dx,dy);
setcolor(15);
line(x+1,y+1,dx-1,y+1);
line(x+1,y+1,x+1,dy-1);
setcolor(0);
line(x,dy,dx,dy);
line(dx,y,dx,dy);
setcolor(8);
line(x+1,dy-1,dx-1,dy-1);
line(dx-1,y+1,dx-1,dy-1);
}*/
void boutton(int x,int y,int z,int w,int c1,int c2,int c3)
{
setfillstyle(SOLID_FILL, c3) ; bar(x,y,z,w) ;
setcolor(c1) ; line(x,y,z,y) ; line(x,y,x,w) ;
setcolor(c2) ; line(x,w,z,w) ; line(z,y,z,w) ;
}
void boutton2(int x,int y,int z,int w,int c1,int c2,int c3)
{
setfillstyle(INTERLEAVE_FILL, c3) ; bar(x,y,z,w) ;
setcolor(c1) ; line(x,y,z,y) ; line(x,y,x,w) ;
setcolor(c2) ; line(x,w,z,w) ; line(z,y,z,w) ;
}
void boutton3(int x,int y,int z,int w,int c1,int c2)
{
setcolor(c1) ; line(x,y,z,y) ; line(x,y,x,w) ;
setcolor(c2) ; line(x,w,z,w) ; line(z,y,z,w) ;
}
void btn1(int x,int y,int z,int w)
{
setfillstyle(SOLID_FILL, 7) ; bar(x+2,y+2,z-2,w-2) ;
setcolor(15) ; line(x+1,y+1,z-2,y+1) ; line(x+1,y+1,x+1,w-2) ;
setcolor(7) ; line(x,y,z-1,y) ; line(x,y,x,w-1) ;
setcolor(8) ; line(z-1,y+1,z-1,w-1) ; line(x+1,w-1,z-1,w-1) ;
setcolor(0) ; line(z,y,z,w) ; line(x,w,z,w) ;
}
void btn2(int x,int y,int z,int w)
{
setcolor(15);rectangle(x,y,z,w);
rectangle(x+1,y+1,z,w);
setcolor(8);rectangle(x,y,z-1,w-1);
}
void btn3(int x,int y,int z,int w)
{
setcolor(15) ; line(z,y,z,w) ; line(x,w,z,w) ;
setcolor(8) ; line(x,y,z-1,y) ; line(x,y,x,w-1) ;
}
void boutton4(int x,int y,int z,int w)
{
boutton3(x,y,z,w,8,15);
boutton(x+1,y+1,z-1,w-1,0,7,15);
}
void fleche(int y,int z,int w)
{
int abc;
abc=(y+w)/2;
mouse_off();
setcolor(0);
line(z-13,abc-2,z-7,abc-2);
line(z-12,abc-1,z-8,abc-1);
line(z-11,abc,z-9,abc);
line(z-10,abc+1,z-10,abc+1);
mouse_on();
}
void btn(int y,int z,int w)
{
mouse_off();
setfillstyle(1,7);
bar(z-15,y+4,z-4,w-4);
setcolor(8);
line(z-3,y+3,z-3,w-3);
line(z-16,w-3,z-3,w-3);
setcolor(15);
line(z-16,y+3,z-4,y+3);
line(z-16,y+3,z-16,w-4);
setcolor(7);
line(z-17,y+2,z-3,y+2);
line(z-17,y+2,z-17,w-3);
setcolor(0);
line(z-2,y+1,z-2,w-2);
line(z-17,w-2,z-2,w-2);
mouse_on();
}
void fermer(int x,int y,int z,int w)
{
setfillstyle(1,7);
bar(x+2,y+2,z,w);
setcolor(0);
rectangle(x+1,y+1,z-1,w-1);
setcolor(8);
rectangle(x,y,z-1,w-1);
setcolor(15);
rectangle(x+1,y+1,z,w);
setcolor(8);
rectangle(x,y,z,w);
setcolor(0);
line(x+5,y+4,z-5,w-5);
line(x+5,y+5,z-5,w-4);
line(x+5,w-5,z-5,y+4);
line(x+5,w-4,z-5,y+5);
}
void boutton5(int x,int y,int z,int w)
{
mouse_off();
setfillstyle(1,15);
bar(x,y,z,w);
setcolor(8);
line(x,y,z-1,y);
line(x,y,x,w-1);
setcolor(15);
line(x,w,z,w);
line(z,y,z,w);
setcolor(7);
line(x+1,w-1,z-1,w-1);
line(z-1,y+1,z-1,w-1);
setcolor(0);
line(x+1,y+1,z-2,y+1);
line(x+1,y+1,x+1,w-2);
btn(y,z,w);
fleche(y,z,w);
mouse_on();
}
void Couleurs()
{
setpalette(6,9);
setpalette(10,36);
setpalette(11,38);
setpalette(14,45);
setpalette(2,32);
setpalette(9,8);
}
void listederoul(int x,int y,int z,int w,int c1)
{
int i;
mouse_off();
for(i=y;i<w;i++)
{
setcolor(0);
rectangle(x,y,z,i);
setfillstyle(1,c1);
bar(x+1,y+1,z-1,i-1);
if(i<=y+9)
delay(7);
if(i>=y+10 && i<y+18)
delay(5);
else
delay(2);
}
settextstyle(SMALL_FONT,0,4);
setcolor(9);
outtextxy(x+5,y+2,"FACTORISATION");
outtextxy(x+5,y+15,"METHODE DE NEWTON");
mouse_on();
}
void ChoixListeDeroul(int x,int y,int z,int w,int k)
{
mouse_off();
setfillstyle(1,15);
bar(x+1,y+1,z-1,w-1);
settextstyle(SMALL_FONT,0,4);
setcolor(9);
outtextxy(x+5,y+2,"FACTORISATION");
outtextxy(x+5,y+15,"METHODE DE NEWTON");
switch(k)
{
case 1 : setcolor(15);setfillstyle(1,4);
bar(x+3,y+2,z-3,y+14); outtextxy(x+5,y+2,"FACTORISATION");
break;
case 2 : setcolor(15);setfillstyle(1,4);
bar(x+3,y+15,z-3,y+27); outtextxy(x+5,y+15,"METHODE DE NEWTON");
break;
}
mouse_on();
}
char *Resultat(int k)
{
char *p;
p = (char *)malloc(sizeof(p)) ;
mouse_off();
boutton5(230,170,435,192);
mouse_on();
settextstyle(SMALL_FONT,0,4);
setfillstyle(1,15);setcolor(9);
switch (k)
{
case 1 :bar(233,173,416,189);
strcpy(p,"FACTORISATION");
setcolor(9) ;outtextxy(235,174,"FACTORISATION");
break;
case 2 :bar(233,173,416,189);
strcpy(p,"METHODE DE NEWTON");
setcolor(9) ; outtextxy(235,174,"METHODE DE NEWTON");
break;
}
return p;
}
void Effacer()
{
boutton(80,160,170,371,0,15,8);
setcolor(15) ;
outtextxy(100,182,"METHODES") ;
boutton(98,194,148,194,15,15,15) ;
outtextxy(95,233,"PARAMETRES") ;
boutton(92,245,155,245,15,15,15) ;
outtextxy(97,284,"RESULTATS") ;
boutton(94,296,152,296,15,15,15) ;
outtextxy(102,336,"EFFACER") ;
boutton(98,348,147,348,15,15,15) ;
boutton(81,385,489,405,15,0,7);
}
void Interface()
{
setpalette(4,29);
setpalette(9,8) ;
settextstyle(SMALL_FONT,0,4);
setfillstyle(10,1);
bar(0,0,645,480);
boutton(60,80,580,420,15,15,7);
boutton(61,80,579,419,15,15,7);
boutton(63,83,577,103,8,8,8);
boutton(80,110,318,130,0,15,7);
boutton(81,111,159,129,15,0,7);
boutton(160,111,238,129,15,0,7);
boutton(239,111,317,129,15,0,7);
setcolor(9) ;
outtextxy(95,115,"A PROPOS") ;
outtextxy(175,115,"METHODES") ;
outtextxy(258,115,"QUITTER") ;
fermer(556,85,571,101);
setcolor(15) ; outtextxy(70,88,"ANALYSE NUMERIQUE ... TP2") ;
Effacer() ;
boutton4(200,160,560,370) ;
boutton(80,384,560,406,0,15,7);
boutton(81,385,489,405,15,0,7);
outtextxy(300,390,"Commandes : ") ;
}
void Date(int x , int y)
{
struct date D ;
getdate(&D);
char CH[6] ;
setpalette(6,5);
setcolor(6);
sprintf(CH,"%d",D.da_day) ; outtextxy(x,y,CH) ;
sprintf(CH,"%d",D.da_mon) ; outtextxy(x+15,y,CH) ;
sprintf(CH,"%d",D.da_year) ; outtextxy(x+30,y,CH) ;
}
void Time(int x , int y)
{
struct time t;
static char s[10];
static sec=0;
gettime(&t);
if ( sec != t.ti_sec )
{
setcolor(7);
boutton(490,385,559,405,15,0,7);
outtextxy(x,y,s);
sprintf(s," %2d:%02d:%02d",t.ti_hour, t.ti_min, t.ti_sec);
setcolor(1);
boutton(490,385,559,405,15,0,7);
outtextxy(x,y,s);
sec=t.ti_sec;
}
}
void ChoixMenu(int k)
{
setpalette(5,32) ;
switch(k)
{
case 1 : Effacer() ; boutton(81,161,169,212,15,0,7);
outtextxy(100,182,"METHODES") ; setcolor(5) ;
outtextxy(93,390,"Le Choix Du M,thodes") ;
break ;
case 2 : Effacer() ; boutton(81,213,169,266,15,0,7);
outtextxy(95,233,"PARAMETRES") ; setcolor(5) ;
outtextxy(93,390,"La Saisie Des Param¦tres") ;
break ;
case 3 : Effacer() ; boutton(81,267,169,319,15,0,7);
outtextxy(100,284,"RESULTATS") ; setcolor(5) ;
outtextxy(93,390,"La Solution Du Systeme Ou De L'Equation") ;
break ;
case 4 : Effacer() ; boutton(81,320,169,370,15,0,7);
outtextxy(100,336,"EFFACER") ; setcolor(5) ;
outtextxy(93,390,"Effacer") ;
break ;
}
}
void MenuMethode()
{
boutton(160,132,310,204,15,0,7);
boutton(165,135,185,199,8,8,8);
setcolor(7);
settextstyle(SMALL_FONT,1,4);
outtextxy(169,144,"METHODES");
settextstyle(SMALL_FONT,0,4);
setcolor(15);
outtextxy(196,142,"Factorisation");
outtextxy(196,162,"M,thode De GAUSS");
outtextxy(196,182,"M,thode De NEWTON");
}
void EffaceMenuMethode()
{
boutton(190,139,300,198,7,7,7) ;
settextstyle(SMALL_FONT,0,4);
setcolor(15);
outtextxy(196,142,"Factorisation");
outtextxy(196,162,"M,thode De GAUSS");
outtextxy(196,182,"M,thode De NEWTON");
}
void ChoixMethode(int k)
{
switch(k)
{
case 1 : EffaceMenuMethode() ; boutton(191,139,300,157,8,8,8) ;
setcolor(15) ; outtextxy(196,142,"Factorisation");
break ;
case 2 : EffaceMenuMethode() ;boutton(191,159,300,177,8,8,8) ;
setcolor(15) ; outtextxy(196,162,"M,thode De GAUSS");
break ;
case 3 : EffaceMenuMethode() ;boutton(191,179,300,197,8,8,8) ;
setcolor(15) ; outtextxy(196,182,"M,thode De NEWTON");
break ;
}
}
void Efface2()
{
boutton(70,131,570,372,7,7,7);
boutton4(200,160,560,370) ;
Effacer() ;
}
void Titre(char Ch[])
{
int i ;
settextstyle(TRIPLEX_FONT,0,3) ;
for ( i=0 ; i<5 ; i++ )
{
setcolor(0) ;
outtextxy(380-i,120+i,Ch) ;
}
setcolor(15) ;
outtextxy(380-i,120+i,Ch) ;
settextstyle(SMALL_FONT,0,4) ;
}
int Methode()
{
int k=0 , L=0 ;
char P ;
MenuMethode() ;
while (k!=5)
{
Date(490,165) ;
while ( Time(495,390) , !kbhit()) ;
P=getch();
switch(P)
{
case 80 : k++; if(k>3) k=1; ChoixMethode(k);
break;
case 72 : k--; if(k<1) k=3; ChoixMethode(k);
break ;
case 13 : switch(k)
{
case 1 : L = 1 ; k = 5 ; Efface2();
Titre("FACTORISATION") ;break ;
case 2 : L = 2 ; k = 5 ; Efface2() ;
Titre("M . GAUSS") ; break ;
case 3 : L = 3 ; k = 5 ; Efface2() ;
Titre("M . NEWTON") ; break ;
}
break ;
case 27 :
case 75 :
case 77 : k = 5 ; break ;
}
}
return L ;
}
void EffaceMenu_P()
{
boutton(81,111,159,129,15,0,7);
boutton(160,111,238,129,15,0,7);
boutton(239,111,317,129,15,0,7);
setcolor(9) ;
outtextxy(95,115,"A PROPOS") ;
outtextxy(175,115,"METHODES") ;
outtextxy(258,115,"QUITTER") ;
}
void ChoixMenu_P(int k)
{
switch(k)
{
case 1 : EffaceMenu_P() ; boutton(81,111,159,129,0,15,7);
outtextxy(95,115,"A PROPOS") ;
break ;
case 2 : EffaceMenu_P() ; boutton(160,111,238,129,0,15,7);
outtextxy(175,115,"METHODES") ;
break ;
case 3 : EffaceMenu_P() ; boutton(239,111,317,129,0,15,7);
outtextxy(258,115,"QUITTER") ;
break ;
}
}
int Menu_P()
{
int k=0 , L ;
char P ;
while (k!=5)
{
Date(490,165) ;
while ( Time(495,390) , !kbhit() ) ;
P=getch();
switch(P)
{
case 77 : k++; if(k>3) k=1; ChoixMenu_P(k);
break;
case 75 : k--; if(k<1) k=3; ChoixMenu_P(k);
break ;
case 13 : switch(k)
{
case 2 : L = Methode() ; k=5 ; break ;
case 3 : k=5 ; break ;
}
break ;
case 27 : k = 5 ;
break ;
}
}
return L ;
}
void main()
{
int E = DETECT , F ;
initgraph(&E,&F,"C:\\Tc") ;
int k=0 , L ;
char P ;
initm() ;
Interface() ;
L = Menu_P() ;
if ( L == 1 || L == 2 || L == 3 )
{
while (k!=5)
{
Date(490,165) ;
while ( Time(495,390) , !kbhit() ) ;
P=getch();
switch(P)
{
case 80 : k++; if(k>4) k=1; ChoixMenu(k);
break;
case 72 : k--; if(k<1) k=4; ChoixMenu(k);
break ;
case 27 : k = 5 ;
break ;
}
}
}
closegraph() ;
}
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
IMAGINE CUP 2012, MAKE A SIGN EN FINALEIMAGINE CUP 2012, MAKE A SIGN EN FINALE par junarnoalg
Voilà qui est fait, la nouvelle est officielle ! L'équipe belge "Make a Sign" va au pays des kangourous défendre son projet dans la catégorie Software Design. http://www.imaginecup.com/CompetitionsContent/Competition/WorldwideFinalists.aspx V...
Cliquez pour lire la suite de l'article par junarnoalg KINECT 1.5 IS OUT !KINECT 1.5 IS OUT ! par Vko
La version 1.5 du Kinect For Microsoft vient tout juste de sortir ! Plein de nouveautés: Tracking de squelette en Near Mode Détection en position assise Détection faciale avec un SDK dédié Documentation et des guideline (enfin) Un out...
Cliquez pour lire la suite de l'article par Vko LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) par richardc
Mise à jour des Web API du 14 Mai
Réservez dès maintenant votre journée du 20 juin pour le Windows Azure Dev Camp 2012 à Paris
Mise à jour de Team Foundation Service
MechCommander 2 sur Windows 8
Entity Framework 5 Release Candidate e...
Cliquez pour lire la suite de l'article par richardc REACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITERREACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITER par Groc
Une mauvaise utilisation de rx lors de l'écriture d'une couche d'accès à des services peut conduire à des cas embarassants avec des erreurs mal gérées, des appels qui ne partent lorsqu'ils le devraient, et même des résultats incorrects . le tout nuis...
Cliquez pour lire la suite de l'article par Groc SHAREPOINT BLOG SITE, PROBLèME D'ARCHIVESSHAREPOINT BLOG SITE, PROBLèME D'ARCHIVES par junarnoalg
Dernièrement, nous avons migré le site
myTIC
vers un nouveau serveur SharePoint 2010. Dans les contenus que nous vouloins récupérer, nous avions un certain nombre de blogs.
Nous avons utilisé les commandes Power...
Cliquez pour lire la suite de l'article par junarnoalg
Forum
RE : SAC A DOS RE : SAC A DOS par hadjkaddour
Cliquez pour lire la suite par hadjkaddour
Logiciels
sDEVIS-FACTURES vlPRO (8.1.0.3)SDEVIS-FACTURES VLPRO (8.1.0.3)sDEVIS-FACTURES vlPRO a été mis au point pour les particuliers, créateurs, entrepreneurs, artisa... Cliquez pour télécharger sDEVIS-FACTURES vlPRO 974 Application Server (12.2.4.6)974 APPLICATION SERVER (12.2.4.6)Développez de puissantes applications dans un environnement de 'cloud computing', clusterisé, séc... Cliquez pour télécharger 974 Application Server vPicture (1.4.2.1)VPICTURE (1.4.2.1)Avec vPicture, hébergez vos images facilement et rapidement.
vPicture est un utilitaire simple, ... Cliquez pour télécharger vPicture Easy-Planning (2.2.1.6)EASY-PLANNING (2.2.1.6)Easy-Planning permet de créer des plannings sous la représentation de diagrammes et est adapté au... Cliquez pour télécharger Easy-Planning COM-BACKUP (2.0)COM-BACKUP (2.0)
COM-BACKUP est un logiciel de sauvegarde qui permet de planifier les sauvegardes de vos dossiers ...
Cliquez pour télécharger COM-BACKUP
|