begin process at 2012 05 27 19:05:10
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Maths & Algorithmes

 > 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

Note :
Aucune note
Catégorie :Maths & Algorithmes Niveau :Débutant Date de création :08/02/2002 Date de mise à jour :14/02/2002 01:46:53 Vu :7 016

Auteur : hamdan

Ecrire un message privé
Site perso
Commentaire sur cette source (2)
Ajouter un commentaire et/ou une note

 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,&reg,&reg);
  • }
  • void mouse_on(void)
  • {
  • reg.x.ax=0x01;
  • int86(0x33,&reg,&reg);
  • }
  • void mouse_off(void)
  • {
  • reg.x.ax=0x02;
  • int86(0x33,&reg,&reg);
  • }
  • int Xm(void)
  • {
  • reg.x.ax=0x03;
  • int86(0x33,&reg,&reg);
  • return(reg.x.cx);
  • }
  • int Ym(void)
  • {
  • reg.x.ax=0x03;
  • int86(0x33,&reg,&reg);
  • 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,&reg,&reg);
  • 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,&reg,&reg);
 }

void mouse_on(void)
 {
   reg.x.ax=0x01;
   int86(0x33,&reg,&reg);
 }

void mouse_off(void)
 {
   reg.x.ax=0x02;
   int86(0x33,&reg,&reg);
 }

int Xm(void)
 {
   reg.x.ax=0x03;
   int86(0x33,&reg,&reg);
   return(reg.x.cx);
 }

int Ym(void)
 {
   reg.x.ax=0x03;
   int86(0x33,&reg,&reg);
   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,&reg,&reg);
   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

Source avec Zip CALCULATRICE SCIENTIFIQUE AVEC LE LIBELLE VERSION 2
Source avec Zip CALCULATRICE EN VISUAL C++ EN ATTANDANT DES AMÉLIORATION
Source avec une capture CONVERTISSEUR DE CHIFFRES ROMAIN AU CHIFFRE DÉCIMALE
MENU DEROULANT ANSI C
SIMULATION DE LA MEMOIRE AVEC LA PAGINATION DE 1000 PAGES [T...

 Sources de la même categorie

Source avec Zip UN EXAMPLE D'APPLICATION EN CUDA DE L'ALGORITHME DE SCAN POU... par oguzaras
Source avec Zip Source avec une capture CHIFFREMENT DE VIGENERE par lajouad
Source avec Zip Source avec une capture ANALYSE SYNTAXIQUE par lajouad
Source avec Zip Source avec une capture STRUCTURE D'UNE MATRICE PAR LES LISTE LINÉAIRE (NON CONTUGUS... par benzarabel
Source avec Zip Source avec une capture DESSINER UNE ARBRE BINAIRE( MODE CONSOLE): par benzarabel

Commentaires et avis

Commentaire de Jo le 09/02/2002 14:49:13

LE NOM DU COMPILATEUR DS LE TITRE DE LA SOURCE !!!!!!!!!!

Commentaire de thierno84 le 23/01/2008 15:39:18

Salut, j'ai un priobleme avec ton projet, kan je le compile tout va tres bien, mais la souris n'apparait pas pour faire un clik  et de faire le choix. sous turbo c il me dit aussi qu'il ne reconnait pas la bibliotheque stream.h, je suis obligé de la mettre en commentaire pour que ca marche. Que dois je faire stp ? car ton ptojet minteresse beaucoup

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,296 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales