IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C Discussion :

Pb d'execution


Sujet :

C

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé Avatar de miron
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    479
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 479
    Par défaut Pb d'execution
    Le code suivant ne fonctionne pas comme desiré, le probleme vien que lorsque j'apuis sur 'a' un dessin devrai s'aficher(au fur et a mesure )
    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
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
     
    #include <stdio.h>
    #include <stdlib.h>
    #include <windows.h>
    #include <time.h>
    #include <conio.h>
    #include <mmsystem.h>
     
    //-----------------------------------------------------------------------------  
    void Ecran(int Mode) // parametre Mode : 1=plein ecran et 2=mode fenetre
    {
         typedef BOOL WINAPI (*SetConsoleDisplayModeT)(HANDLE,DWORD,DWORD*);
         SetConsoleDisplayModeT SetConsoleDisplayMode;
     
        HINSTANCE hLib=LoadLibrary("KERNEL32.DLL");
        SetConsoleDisplayMode=(SetConsoleDisplayModeT)
           GetProcAddress(hLib,"SetConsoleDisplayMode");
     
        HANDLE h=CreateFile("CONOUT$",GENERIC_WRITE|GENERIC_READ,FILE_SHARE_READ |
           FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,0);
     
        DWORD oldmode;
     
        SetConsoleDisplayMode(h,Mode,&oldmode);
    }
    //-----------------------------------------------------------------------------
    void aff(int x,int y)
    {
      int c,touche=0;
     
      HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
      COORD pos={x,y};
      SetConsoleCursorPosition(handle,pos); 
     
      if (kbhit()!=0) 
         while ((touche==0||touche==224)&&(touche!=27||touche!=97))
               touche=getch();
      /*if (kbhit())
         touche==getch();*/
     
      if(touche==27) exit(0);
     
      if (touche==97)
      {
         //SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 1);//0x0a
         if (y==10&&x>10&&x<70)
               printf("%c",196);
       else if (y==10&&x==10)
               printf("%c",218);
       else if (y==10&&x==70)
               printf("%c",191);
         else if (y==40&&x>10&&x<70)
               printf("%c",196);
         else if (y==40&&x==10)
               printf("%c",192);
         else if (y==40&&x==70)
               printf("%c",217);
         else if (x==10&&y>10&&y<40)
               printf("%c",179);
         else if (x==70&&y>10&&y<40)
               printf("%c",179);
         }
      else if (x!=79||y!=50)
      {
          //SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
          c=(rand()%200)+10;
          printf("%c",c);
      }
    }
     
     
    //-----------------------------------------------------------------------------
     
    int main()
    {
      printf(" Par Pierre BLACHE...");
      Sleep(5000);
      system("cls"); 
      int x,x1,x2,x3,x4,x5,x6,x7,x8,x9,y,y1,y2,y3,y4,y5,y6,y7,y8,y9;
      Ecran(1);
      srand((unsigned)time(NULL));
     
      SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
     
      for (x=0;x<80;x++) for (y=1;y<=50;y++) aff(x,y);
     
      y1=rand()%50;
      y2=rand()%50;
      y3=rand()%50;  
      y4=rand()%50;
      y5=rand()%50;
      y6=rand()%50;
      y7=rand()%50;
      y8=rand()%50;
      y9=rand()%50;
     
      while(1)
      {
     
      y1++;
      y2++;
      y3++;
      y4++;
      y5++;
      y6++;
      y7++;
      y8++;
      y9++;
     
      if (y1>50){ x1=rand()%80; y1=1;}
      aff(x1,y1);
     
      if (y2>50){ x2=rand()%80; y2=1;}
      aff(x2,y2);
     
      if (y3>50){ x3=rand()%80; y3=1;}
      aff(x3,y3);
     
      if (y4>50){ x4=rand()%80; y4=1;}
      aff(x4,y4);
     
      if (y5>50){ x5=rand()%80; y5=1;}
      aff(x5,y5);
     
      if (y6>50){ x6=rand()%80; y6=1;}
      aff(x6,y6);
     
      if (y7>50){ x7=rand()%80; y7=1;}
      aff(x7,y7);
     
      if (y8>50){ x8=rand()%80; y8=1;}
      aff(x8,y8);
     
      if (y9>50){ x9=rand()%80; y9=1;}
      aff(x9,y9);
     
    //  sndPlaySound("Son.wav", SND_SYNC );
     
      Sleep(20);
      }
     
      return 0;
    }

  2. #2
    Membre émérite Avatar de crocodilex
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    697
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 697
    Par défaut
    Wouah....ben chez moi ça marche...
    J'ai un truc à la Matrix.....

    Tu as fais ça tout seul ??

  3. #3
    Membre éclairé Avatar de miron
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    479
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 479
    Par défaut
    Citation Envoyé par crocodilex
    Wouah....ben chez moi ça marche...
    J'ai un truc à la Matrix.....

    Tu as fais ça tout seul ??
    Caitais le but
    Ca marche?
    Bizare...
    Pour le tout seul, oui, mais avec developpez .com et ses participant...

  4. #4
    Membre émérite Avatar de crocodilex
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    697
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 697
    Par défaut
    Par contre en mode fenêtre l'effet est différent. On a l'impression que tout le contenu défile dans la fenêtre.
    Est-ce normal ?

  5. #5
    Membre éclairé Avatar de miron
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    479
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 479
    Par défaut
    Citation Envoyé par crocodilex
    Par contre en mode fenêtre l'effet est différent. On a l'impression que tout le contenu défile dans la fenêtre.
    Est-ce normal ?
    Si'il y a une fonction plein ecrran c'est quil faut que ca soit en plein ecran!!!

  6. #6
    Membre éclairé Avatar de miron
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    479
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 479
    Par défaut
    Par contre j'espere que vous respectez les codes...
    Ceux qui les font quoi...

  7. #7
    Expert éminent
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 68
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Par défaut
    Citation Envoyé par miron
    Le code suivant ne fonctionne pas comme desiré,
    Comportement indéfini :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    main.c: In function `main_':
    main.c:78: warning: 'x1' might be used uninitialized in this function
    main.c:78: warning: 'x2' might be used uninitialized in this function
    main.c:78: warning: 'x3' might be used uninitialized in this function
    main.c:78: warning: 'x4' might be used uninitialized in this function
    main.c:78: warning: 'x5' might be used uninitialized in this function
    main.c:78: warning: 'x6' might be used uninitialized in this function
    main.c:78: warning: 'x7' might be used uninitialized in this function
    main.c:78: warning: 'x8' might be used uninitialized in this function
    main.c:78: warning: 'x9' might be used uninitialized in this function
    Trop compliqué... Ceci fonctionne...
    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
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
     
    /* donne acces aux fonctions NT comme SetConsoleDisplayMode() */
    #define _WIN32_WINNT 0x0501
     
    #include <stdio.h>
    #include <stdlib.h>
    #include <windows.h>
    #include <conio2.h>
     
    /* <a href="http://emmanuel-delahaye.developpez.com/clib.htm" target="_blank">http://emmanuel-delahaye.developpez.com/clib.htm</a> */
    #include "ed/inc/random.h"
     
    //-----------------------------------------------------------------------------
    static void Ecran(int Mode) // parametre Mode : 1=plein ecran et 2=mode fenetre
    {
       HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
       DWORD oldmode;
     
       SetConsoleDisplayMode(h, Mode, &oldmode);
    }
     
    //-----------------------------------------------------------------------------
    static int getRandomChar()
    {
       static char const a[] =
          "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
     
       int i = random(sizeof a - 1);
     
       return a[i];
    }
     
    //-----------------------------------------------------------------------------
    static void aff_rand(int x, int y)
    {
       gotoxy (x, y);
     
       {
          int c = getRandomChar();
          putch(c);
       }
    }
     
    //-----------------------------------------------------------------------------
    static void aff_blank(int x, int y)
    {
       gotoxy (x, y);
       putch(' ');
    }
     
    //-----------------------------------------------------------------------------
    int main()
    {
       printf(" Par Pierre BLACHE...");
       Sleep(3000);
       clrscr();
       Ecran(1);
       randomize();
       {
          struct text_info ti;
          gettextinfo(&ti);
    #define X ti.screenwidth
    #define Y ti.screenheight
    #define N (X/2)
          {
             int end = 0;
             struct pos
             {
                int x;
                int y;
                int cnt;
             }
             apos[N];
     
             {
                int i;
                for (i = 0; i < N; i++)
                {
                   struct pos *p = apos + i;
                   p->x = 1 + random(X);
                   p->y = 1;
                   p->cnt = 0;
                }
             }
             textcolor(GREEN);
             while (!end)
             {
                {
                   int i;
                   for (i = 0; i < N; i++)
                   {
                      struct pos *p = apos + i;
                      if (p->cnt)
                      {
                         aff_blank(p->x, p->y);
                      }
                      else
                      {
                         aff_rand(p->x, p->y);
                      }
                      p->y++;
                      if (p->cnt)
                      {
                         p->cnt--;
                      }
                      if (p->y > Y)
                      {
                         p->x = 1 + random(X);
                         p->y = 1 + random(Y);
                         ;
                         p->cnt = random(20);
                      }
                   }
                }
                Sleep(20);
                if (kbhit())
                {
                   int touche = getch();
                   switch (touche)
                   {
                   case 27:      /* ESC */
                      end = 1;
                      ;
                      break;
                   }
                }
             }
          }
          Ecran(0);
          textattr(ti.attribute);
       }
       clrscr();
       return 0;
    }
    Pose des questions si tu ne comprends pas...

  8. #8
    Membre éclairé Avatar de miron
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    479
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 479
    Par défaut
    Citation Envoyé par Emmanuel Delahaye
    Comportement indéfini :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    main.c: In function `main_':
    main.c:78: warning: 'x1' might be used uninitialized in this function
    main.c:78: warning: 'x2' might be used uninitialized in this function
    main.c:78: warning: 'x3' might be used uninitialized in this function
    main.c:78: warning: 'x4' might be used uninitialized in this function
    main.c:78: warning: 'x5' might be used uninitialized in this function
    main.c:78: warning: 'x6' might be used uninitialized in this function
    main.c:78: warning: 'x7' might be used uninitialized in this function
    main.c:78: warning: 'x8' might be used uninitialized in this function
    main.c:78: warning: 'x9' might be used uninitialized in this function
    I know that.
    But its not the problem!!!

  9. #9
    Expert éminent
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 68
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Par défaut
    Citation Envoyé par miron
    I know that.
    But its not the problem!!!
    it's ...

  10. #10
    Membre éclairé Avatar de miron
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    479
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 479
    Par défaut
    Citation Envoyé par Emmanuel Delahaye
    it's ...
    No beacousse j'ai chager et ... ca change rien...!!!

Discussions similaires

  1. executer une application a distance : Sockets ? RPC ? CORBA?
    Par a_hic dans le forum Développement
    Réponses: 5
    Dernier message: 30/05/2006, 13h02
  2. [Kylix] Probleme d'execution de programmes...
    Par yopziggy dans le forum EDI
    Réponses: 19
    Dernier message: 03/05/2002, 14h50
  3. [Kylix] Demarrer en cliquant sur l'executable ???
    Par Anonymous dans le forum EDI
    Réponses: 2
    Dernier message: 26/04/2002, 11h24
  4. [Kylix] Execution d'une application hors de l'edi
    Par Sadam Sivaller dans le forum EDI
    Réponses: 1
    Dernier message: 20/04/2002, 23h22
  5. Réponses: 2
    Dernier message: 17/03/2002, 19h00

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo