Commentçamarche.net
CodeS-SourceS
Rechercher un code, un tuto, une réponse

Jeu pendu + graph

0/5 (5 avis)

Vue 4 764 fois - Téléchargée 238 fois

Description

le jeu pendu: un joueur ou bien deux plus un rigolo graphique.

ps: il faut gagnée pour voir la suit de l'histoire!!!!!

"Etudiant a l'IGA"

Source / Exemple :


#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<dos.h>
#define q 20
int main(void)
{
   int gdriver = DETECT, gmode;
   int N,bln,y,s,i,t[q],t2[q],cp,f;
    int j,z,h,p,k,a,x,l,m,g,v,o,e,r,u;
   char choix,niv,rep;
   float pr;
   initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

 setcolor(7);
      /*    sol  */
   line(65,350,550,350);
   line(65,351,550,351);
   line(65,352,550,352);
   setcolor(15);

      /*le plafond*/
   setcolor(14);
   line(45,145,570,145);
   line(45,144,570,144);
   line(45,143,570,143);
   line(45,145,300,0);
   line(44,145,299,0);
   line(43,145,298,0);
   line(55,145,295,15);
   line(56,145,296,15);
   line(57,145,297,15);
   line(560,145,298,15);
   line(559,145,297,15);
   line(558,145,296,15);
   line(570,145,296,0);
   line(571,145,297,0);
   line(572,145,298,0);
   line(250,250,420,250);
   line(420,250,420,282);
   circle(420,295,12);
      gotoxy(2,2);
 /* select the text style */
settextstyle(4, HORIZ_DIR, 8);
/* output a message */
outtextxy(getmaxx()/3, getmaxy()/3,"Pendu");
   setcolor(15);
gotoxy(2,2);
 /* select the text style */
settextstyle(8, HORIZ_DIR,1);
/* output a message */
outtextxy(getmaxx()/3, getmaxy()/1.95,"Version HCL");

    setcolor(8);
      /*bande gauche*/
   line(95,150,95,335);
   line(96,150,96,335);
   line(97,150,97,335);
   line(130,150,130,335);
   line(131,150,131,335);
   line(132,150,132,335);

   line(95,335,130,300);   /* 2 */
   line(96,335,131,300);
   line(97,335,132,300);
   line(98,335,133,300);   /**/
   o=30;
   line(95,335-o,130,300-o);   /* 2 */
   line(96,335-o,131,300-o);
   line(97,335-o,132,300-o);
   line(98,335-o,133,300-o);   /**/

   v=60;
   line(95,335-v,130,300-v);   /* 2 */
   line(96,335-v,131,300-v);
   line(97,335-v,132,300-v);
   line(98,335-v,133,300-v);
   e=90;
   line(95,335-e,130,300-e);   /* 2 */
   line(96,335-e,131,300-e);
   line(97,335-e,132,300-e);
   line(98,335-e,133,300-e);
   r=120;
   line(95,335-r,130,300-r);   /* 2 */
   line(96,335-r,131,300-r);
   line(97,335-r,132,300-r);
   line(98,335-r,133,300-r);
   u=150;
   line(95,335-u,130,300-u);   /* 2 */
   line(96,335-u,131,300-u);
   line(97,335-u,132,300-u);
   line(98,335-u,133,300-u);

   line(80,350,95,335);
   line(81,350,96,335);
   line(82,350,97,335);
   line(145,350,130,335);
   line(146,350,131,335);
   line(147,350,132,335);
   line(80,150,145,150);
   line(80,151,145,151);
   line(80,152,145,152);
   line(80,150,80,145);
   line(81,150,81,145);
   line(82,150,82,145);
   line(145,150,145,145);
   line(146,150,146,145);
   line(147,150,147,145);
      /*bande droite*/
   g=385;
   line(95+g,150,95+g,335);
   line(96+g,150,96+g,335);
   line(97+g,150,97+g,335);
   line(130+g,150,130+g,335);
   line(131+g,150,131+g,335);
   line(132+g,150,132+g,335);
   line(80+g,350,95+g,335);
   line(81+g,350,96+g,335);
   line(82+g,350,97+g,335);
   line(145+g,350,130+g,335);
   line(146+g,350,131+g,335);
   line(147+g,350,132+g,335);
   line(80+g,150,145+g,150);
   line(80+g,151,145+g,151);
   line(80+g,152,145+g,152);
   line(80+g,150,80+g,145);
   line(81+g,150,81+g,145);
   line(82+g,150,82+g,145);
   line(145+g,150,145+g,145);
   line(146+g,150,146+g,145);
   line(147+g,150,147+g,145);

   line(95+g,335,130+g,300);   /* 2 */
   line(96+g,335,131+g,300);
   line(97+g,335,132+g,300);
   line(98+g,335,133+g,300);   /**/
   o=30;
   line(95+g,335-o,130+g,300-o);   /* 2 */
   line(96+g,335-o,131+g,300-o);
   line(97+g,335-o,132+g,300-o);
   line(98+g,335-o,133+g,300-o);   /**/

   v=60;
   line(95+g,335-v,130+g,300-v);   /* 2 */
   line(96+g,335-v,131+g,300-v);
   line(97+g,335-v,132+g,300-v);
   line(98+g,335-v,133+g,300-v);
   e=90;
   line(95+g,335-e,130+g,300-e);   /* 2 */
   line(96+g,335-e,131+g,300-e);
   line(97+g,335-e,132+g,300-e);
   line(98+g,335-e,133+g,300-e);
   r=120;
   line(95+g,335-r,130+g,300-r);   /* 2 */
   line(96+g,335-r,131+g,300-r);
   line(97+g,335-r,132+g,300-r);
   line(98+g,335-r,133+g,300-r);
   u=150;
   line(95+g,335-u,130+g,300-u);   /* 2 */
   line(96+g,335-u,131+g,300-u);
   line(97+g,335-u,132+g,300-u);
   line(98+g,335-u,133+g,300-u);

   gotoxy(2,2);
 /* select the text style */
settextstyle(8, HORIZ_DIR, 2);
/* output a message */
setcolor(RED);
outtextxy(getmaxx()/6, getmaxy()/1.25,"Realis&#8218; par :  Mounir _ Mourad");
setcolor(15);
   getch();

do
{
cleardevice();
line(270,260,445,260);
line(270,165,445,165);
line(270,234,445,234);
line(270,260,270,165);
line(445,260,445,165);
gotoxy(35,12);
printf(" A--un joueur\n");
gotoxy(35,13);
printf(" B--deux joueurs\n");
gotoxy(35,14);
printf(" C--quitter\n");
gotoxy(35,16);
printf(" Tapez votre choix: ");
do
{
choix=getch();
}while(choix!='a'&&choix!='b'&&choix!='c');

switch(choix)
{
 case 'a':
cleardevice();
randomize();
line(220,260,445,260);
line(220,165,445,165);
line(220,234,445,234);
line(220,260,220,165);
line(445,260,445,165);
gotoxy(30,12);
printf("D--(N=6)---------D&#8218;butant\n");
gotoxy(30,13);
printf("I--(N=9)----Interm&#8218;diaire\n");
gotoxy(30,14);
printf("E--(N=12)----------Expert\n");
do
{
 gotoxy(30,16);
 printf("  Tapez votre choix : ");
 niv=getch();
}while(niv!='d'&&niv!='e'&&niv!='i');
cleardevice();
  switch(niv)
  {
	case 'd': N=6;break;
	case 'e': N=9;break;
	case 'i': N=12;break;
  }
  s=0;
  pr=1;
for(i=0;i<N;i++)
   {
     t[i]=random(10);
     s=t[i]+s;
     pr=t[i]*pr;
   }
for(j=0;j<N;j++)
   t2[j]=t[j];
    /*affichage*/
// for(j=0;j<N;j++)
//     printf("t2[%d]=%d \n",j,t2[j]);

   p=0;
   x=0;
   f=0;
  cp=0;
//getch();
do
 {
 cleardevice();
line(0,320,150,320);
gotoxy(1,20);
printf("entrer un nombre:\n");
gotoxy(1,24);
printf("la somme est : %d\n",s);
printf("le produit est: %.0f\n\n",pr);
printf("le premier nombre est: %d \n",t[0]);
printf("le dernier nombre est: %d \n",t[N-1]);

      /*  objet (princesse)*/
       h=-50;
       line(375,150+h,375,75+h);
       line(377,150+h,377,73+h);
       line(375,75+h,345,75+h);
       line(345,75+h,345,73+h);
       line(345,73+h,377,73+h);
       circle(345,80+h,5);
       circle(345,89+h,5);
       circle(345,98+h,5);
	/*    princesse*/
       k=-100;
       line(347,170+k,350,170+k);
       line(343,170+k,340,170+k);
       circle(348,172+k,1.7);
       circle(342,172+k,1.7);
       line(345,176+k,345,177+k);
       line(344,180+k,346,180+k);

       circle(345,175+k,10);
       line(340,190+k,335,175+k);
       line(350,190+k,355,175+k);
       line(348,145+k,355,170+k);
       line(342,145+k,335,170+k);
       line(345,185+k,330,215+k);
       line(345,185+k,363,215+k);
       line(330,215+k,363,215+k);
       line(340,215+k,340,222+k);
       line(350,215+k,350,222+k);
       /* les cheveux de princesse*/
       setcolor(YELLOW);
       for(i=0;i<=5;i++)
	{
	  circle(350,160+k,i);
	}
       line(355,160+k,355,180+k);
       line(355,160+k,356,180+k);
       line(355,160+k,357,180+k);
       line(355,160+k,358,180+k);
       line(355,160+k,359,180+k);
       line(355,160+k,360,180+k);
       line(355,160+k,361,180+k);
       setcolor(WHITE);

       /*    le sol   */
       setcolor(10);

       line(0,131,150+p,131);
       line(0,132,150+p,132);
       line(0,130,150+p,130);
       line(700,150+h,375,150+h);
       line(700,151+h,375,151+h);
       line(700,152+h,375,152+h);
       setcolor(WHITE);
       /*  utilisateur*/

	circle(75,70,9.5);
	line(93,66,63,66);
	line(93,66,63,54);
	line(63,54,63,66);

	line(65,80,85,80);
	line(65,80,65,105.5);
	line(85,80,85,105.5);
	line(85,80,110,75);
	line(85,85,110,75);
	line(65,105.5,85,105.5);
	line(65,80,55,95);
	line(55,95,65,105.5);
	line(65,85,60,95);
	line(60,90,65,105.5);
	line(65,130,65,105.5);
	line(85,125,85,105.5);
	line(75,105.5,75,125);
	line(75,125,78,125);
	line(78,125,78,130);
	line(85,125,88,125);
	line(88,125,88,130);
	line(65,120,85,120);

       /*   le bassin de hcl */

	line(200,350,600,350);

	line(198,315,198,600);
	line(602,315,602,600);
	line(198,479,602,479);
	setcolor(RED);
	for(i=0;i<402;i++)
	 line(200+i,350,200+i,477);

	setcolor(WHITE);
	setcolor(12);
	 circle(250,320,5);
	 circle(290,325,4);
	 circle(320,330,3);
	 circle(391,320,6);
	 circle(420,331,4);
	 circle(490,320,4);
	 circle(530,326,5);
	 circle(550,320,6);
	 setcolor(WHITE);

       /*    pirate    */
	 circle(610+x,120+h,20);
	 circle(610+x,90+h,10);
	 circle(622+x,85+h,2);
	 circle(615+x,90+h,2);
	 circle(605+x,90+h,1);
	 circle(610+x,118+h,4);
	 line(590+x,120+h,630+x,120+h);
	 line(625+x,85+h,628+x,75+h);
	 line(628+x,75+h,625+x,75+h);
	 line(625+x,75+h,625+x,85+h);
	 line(625+x,95+h,625+x,75+h);
	 line(625+x,95+h,628+x,95+h);
	 line(628+x,95+h,625+x,75+h);
	 line(590+x,115+h,630+x,115+h);

	 line(600+x,85+h,620+x,85+h);
	 line(630+x,150+h,625+x,132+h);
	 line(595+x,132+h,590+x,150+h);
	 for(i=602+x;i<=604+x;i++)
		for(j=120;j<=139;j++)
		{

			line(i,j+h,i,j+h);
		}
	 for(i=615+x;i<=617+x;i++)
		for(j=120;j<=139;j++)
		{

			line(i,j+h,i,j+h);
		}
	 circle(605+x,90+h,1);
	 circle(615+x,90+h,1);
	 circle(605+x,115+h,1);
	 circle(615+x,115+h,1);
	 circle(601+x,105+h,1);
	 circle(619+x,105+h,1);
	 line(601+x,105+h,601+x,105+h);
	 line(601+x,105+h,601+x,105+h);
	 line(605+x,115+h,605+x,115+h);
	 line(615+x,115+h,615+x,115+h);
	 line(595+x,108+h,580+x,120+h);
	  /* objet pirate*/
	 circle(450,115+h,3);
	 line(450,119+h,450,135+h);
	 line(450,135+h,465,150+h);
	 line(450,135+h,435,150+h);
  gotoxy(18,20);
  scanf("%d",&y);

  bln=0;
   for(i=1;i<N-1;i++)
    {
    if(y==t[i])
      {
	bln=1;
	break;
      }
    }
	if(bln==1)
	{
	 printf(" bravo \n");
	 cp++;
	 t[i]=-1;
	}
	else
	{
	 f++;
	x=x-25;
	}

  }while(f<6 && cp!=N-2);
bln=0;
if(cp==N-2)
{
		       printf("\n vous avez gang&#8218;");
s=0;
x=-80;
p=230;
z=1;
l=0;
m=0;
do
{
cleardevice();
if(z==0 && m<=120)
 {
 m=m+10;
 l=l+10;
  setcolor(RED);
 line(520,345-l,520,315-l);
 line(530,310-l,530,290-l);
 line(540,325-l,540,300-l);

 line(520,305-l,520,265-l);
 line(530,270-l,530,250-l);
 line(540,285-l,540,260-l);
 }

/*  objet (princesse)*/
      s=s+50;
       h=-50;
       setcolor(8);
       line(375,150+h,375,75+h);
       line(377,150+h,377,73+h);
       line(375,75+h,345,75+h);
       line(345,75+h,345,73+h);
       line(345,73+h,377,73+h);
       circle(345,80+h,5);
       circle(345,89+h,5);
       circle(345,98+h,5);
       /*    princesse*/
       k=-90;
       setcolor(7);

       line(345-m,170+k,347-m,170+k);
       line(341-m,170+k,338-m,170+k);
       circle(346-m,172+k,1.7);
       circle(340-m,172+k,1.7);
       line(343-m,176+k,343-m,177+k);
       line(342-m,180+k,344-m,180+k);

       circle(345-m,175+k,10);
       line(341-m,190+k,334-m,200+k);
       line(349-m,190+k,345-m,200+k);
       line(345-m,185+k,330-m,215+k);
       line(345-m,185+k,363-m,215+k);
       line(330-m,215+k,363-m,215+k);
       line(340-m,215+k,340-m,222+k);
       line(350-m,215+k,350-m,222+k);
       /* les cheveux de princesse*/
       setcolor(YELLOW);
       for(i=0;i<=5;i++)
	{
	  circle(350-m,160+k,i);
	}
       line(355-m,160+k,355-m,180+k);
       line(355-m,160+k,356-m,180+k);
       line(355-m,160+k,357-m,180+k);
       line(355-m,160+k,358-m,180+k);
       line(355-m,160+k,359-m,180+k);
       line(355-m,160+k,360-m,180+k);
       line(355-m,160+k,361-m,180+k);
       setcolor(WHITE);

       /*    le sol   */
       setcolor(10);

       line(0,131,150+p,131);
       line(0,132,150+p,132);
       line(0,130,150+p,130);
       line(500,150+h,375,150+h);
       line(500,151+h,375,151+h);
       line(500,152+h,375,152+h);

       line(560,150+h,700,150+h);
       line(560,151+h,700,151+h);
       line(560,152+h,700,152+h);
       setcolor(WHITE);
       /*  utilisateur*/

	circle(35+m,70,9.5);
	line(53+m,66,23+m,66);
	line(43+m,66,23+m,54);
	line(23+m,54,23+m,66);

	line(25+m,80,45+m,80);
	line(25+m,80,25+m,105.5);
	line(45+m,80,45+m,105.5);
	line(25+m,80,70+m,75);
	line(45+m,85,70+m,75);
	line(25+m,105.5,45+m,105.5);
	line(25+m,80,15+m,95);
	line(15+m,95,25+m,105.5);
	line(25+m,85,20+m,95);
	line(20+m,90,25+m,105.5);
	line(25+m,130,25+m,105.5);
	line(45+m,125,45+m,105.5);
	line(35+m,105.5,35+m,125);
	line(35+m,125,38+m,125);
	line(38+m,125,38+m,130);
	line(45+m,125,48+m,125);
	line(48+m,125,48+m,130);
	line(25+m,120,45+m,120);

       /*   le bassin de hcl */

	line(200,350,600,350);

	line(198,315,198,600);
	line(602,315,602,600);
	line(198,479,602,479);
	setcolor(RED);
	for(i=0;i<402;i++)
	 line(200+i,350,200+i,477);

	setcolor(WHITE);
	setcolor(12);
	 circle(250,320,5);
	 circle(290,325,4);
	 circle(320,330,3);
	 circle(391,320,6);
	 circle(420,331,4);
	 circle(490,320,4);
	 circle(530,326,5);
	 circle(550,320,6);
	 setcolor(WHITE);

	/* objet pirate*/
	 setcolor(7);
	 circle(450,65,3);
	 line(450,69,450,85);
	 line(450,85,465,100);
	 line(450,85,435,100);
       /*    pirate    */
	 circle(z*(610+x),z*(120+h+s),z*(20));
	 circle(z*(610+x),z*(90+h+s),z*(10));
	 circle(z*(622+x),z*(85+h+s),z*(2));
	 circle(z*(615+x),z*(90+h+s),z*(2));
	 circle(z*(605+x),z*(90+h+s),z*(1));
	 circle(z*(610+x),z*(118+h+s),z*(4));
	 line(z*(590+x),z*(120+h+s),z*(630+x),z*(120+h+s));
	 line(z*(625+x),z*(85+h+s),z*(628+x),z*(75+h+s));
	 line(z*(628+x),z*(75+h+s),z*(625+x),z*(75+h+s));
	 line(z*(625+x),z*(75+h+s),z*(625+x),z*(85+h+s));
	 line(z*(625+x),z*(95+h+s),z*(625+x),z*(75+h+s));
	 line(z*(625+x),z*(95+h+s),z*(628+x),z*(95+h+s));
	 line(z*(628+x),z*(95+h+s),z*(625+x),z*(75+h+s));
	 line(z*(590+x),z*(115+h+s),z*(630+x),z*(115+h+s));

	 line(z*(600+x),z*(85+h+s),z*(620+x),z*(85+h+s));
	 line(z*(630+x),z*(150+h+s),z*(625+x),z*(132+h+s));
	 line(z*(595+x),z*(132+h+s),z*(590+x),z*(150+h+s));
	 for(i=602+x;i<=604+x;i++)
		for(j=120;j<=139;j++)
		{

			line(z*(i),z*(j+h+s),z*(i),z*(j+h+s));
		}
	 for(i=615+x;i<=617+x;i++)
		for(j=120;j<=139;j++)
		{

			line(z*(i),z*(j+h+s),z*(i),z*(j+h+s));
		}
	 circle(z*(605+x),z*(90+h+s),z*(1));
	 circle(z*(615+x),z*(90+h+s),z*(1));
	 circle(z*(605+x),z*(115+h+s),z*(1));
	 circle(z*(615+x),z*(115+h+s),z*(1));
	 circle(z*(601+x),z*(105+h+s),z*(1));
	 circle(z*(619+x),z*(105+h+s),z*(1));
	 line(z*(601+x),z*(105+h+s),z*(601+x),z*(105+h+s));
	 line(z*(601+x),z*(105+h+s),z*(601+x),z*(105+h+s));
	 line(z*(605+x),z*(115+h+s),z*(605+x),z*(115+h+s));
	 line(z*(615+x),z*(115+h+s),z*(615+x),z*(115+h+s));
	 line(z*(595+x),z*(108+h+s),z*(580+x),z*(120+h+s));

 if(s==350)
 {
 z=0;
 }

 delay(100);
 }while(m<=120);
 cleardevice();
			/*prince.princece*/

  line(445,350,463,330);
  line(445,350,463,348);
  circle(0,300,200);
  circle(650,300,200);
  arc(500,240,20,160,30);
  arc(500,220,200,340,30);
  circle(495,232,10);
  arc(140,210,80,360,40);
  circle(130,225,20);
  line(130,400,170,410);
  line(130,400,185,375);
  line(130,400,180,390);
  line(0,150,200,150);
  line(0,60,200,150);
  arc(50,250,90,270,30);
  circle(200,325,10);
  line(50,155,50,155);
  setcolor(GREEN);
  for(i=0;i<=220;i++)
	for(j=60;j<=65;j++)
	 {

	     line(2,60,2+i,90+j);
	 }

  setcolor(WHITE);
  setcolor(RED);
  line(510,400,478,400);
  arc(500,400,100,180,25);
  arc(515,380,175,295,20);
  arc(500,400,180,360,20);
  setcolor(WHITE);
  setcolor(YELLOW);
  for(i=550;i<=700;i++)
		for(j=100;j<=550;j++)
		{

			line(i,j,i,j);
		}
  line(500,40,550,100);
  line(500,30,550,100);
  line(500,900,550,100);
  line(500,800,550,100);
  line(500,700,550,100);
  line(500,4000,550,100);
  line(500,3000,550,100);
  line(500,1000,550,100);
  line(500,2000,550,100);
  line(500,50,550,100);
  line(500,60,550,100);
  line(500,70,550,100);
  setcolor(WHITE);
  setcolor(RED);
  line(335,250,402,150);
  line(335,250,262,150);
  arc(368,150,0,180,35);
  arc(298,150,0,180,35);
  setcolor(WHITE);
}
else
{
bln=1;
	     printf("vous avez perdu");
 k=0;
 p=0;
 x=-110;
 l=0;
 z=1;
do
{
cleardevice();
for(j=0;j<N;j++)
   {
   line(0,320,150,320);
   gotoxy(2+j+j,20);
   printf("%d",t2[j]);
   }
if(k==300)
{
 z=0;
}
if(z==0)
{
 l=l+10;
  setcolor(RED);
 line(350,345-l,350,315-l);
 line(360,310-l,360,290-l);
 line(340,325-l,340,300-l);

 line(360,305-l,360,265-l);
 line(340,270-l,340,250-l);
 line(350,285-l,350,260-l);
}
k=k+30;

/*  objet (princesse)*/

      setcolor(WHITE);
       h=-50;
       line(375,150+h,375,75+h);
       line(377,150+h,377,73+h);
       line(375,75+h,345,75+h);
       line(345,75+h,345,73+h);
       line(345,73+h,377,73+h);
       circle(345,80+h,5);
       circle(345,89+h,5);
       circle(345,98+h,5);
	/*    princesse*/
       line(z*(347),z*(70+k),z*(350),z*(70+k));
       line(z*(343),z*(70+k),z*(340),z*(70+k));
       circle(z*(348),z*(72+k),z*(1.7));
       circle(z*(342),z*(72+k),z*(1.7));
       line(z*(345),z*(76+k),z*(345),z*(77+k));
       line(z*(344),z*(80+k),z*(346),z*(80+k));

       circle(z*(345),z*(75+k),z*(10));
       line(z*(340),z*(90+k),z*(335),z*(75+k));
       line(z*(350),z*(90+k),z*(355),z*(75+k));
       line(z*(348),z*(45+k),z*(355),z*(70+k));
       line(z*(342),z*(45+k),z*(335),z*(70+k));
       line(z*(345),z*(85+k),z*(330),z*(115+k));
       line(z*(345),z*(85+k),z*(363),z*(115+k));
       line(z*(330),z*(115+k),z*(363),z*(115+k));
       line(z*(340),z*(115+k),z*(340),z*(122+k));
       line(z*(350),z*(115+k),z*(350),z*(122+k));
       /* les cheveux de princesse*/
       setcolor(YELLOW);
       for(i=0;i<=5;i++)
	{
	  circle(z*(350),z*(60+k),z*(i));
	}
       line(z*(355),z*(60+k),z*(355),z*(80+k));
       line(z*(355),z*(60+k),z*(356),z*(80+k));
       line(z*(355),z*(60+k),z*(357),z*(80+k));
       line(z*(355),z*(60+k),z*(358),z*(80+k));
       line(z*(355),z*(60+k),z*(359),z*(80+k));
       line(z*(355),z*(60+k),z*(360),z*(80+k));
       line(z*(355),z*(60+k),z*(361),z*(80+k));
       setcolor(WHITE);

       /*    le sol   */
       setcolor(10);

       line(0,131,150+p,131);
       line(0,132,150+p,132);
       line(0,130,150+p,130);
       line(700,150+h,375,150+h);
       line(700,151+h,375,151+h);
       line(700,152+h,375,152+h);
       setcolor(WHITE);
       /*  utilisateur*/

	circle(75,70,9.5);
	line(93,66,63,66);
	line(93,66,63,54);
	line(63,54,63,66);

	line(65,80,85,80);
	line(65,80,65,105.5);
	line(85,80,85,105.5);
	line(85,80,110,100);
	line(85,85,110,100);
	line(65,105.5,85,105.5);
	line(65,80,55,95);
	line(55,95,65,105.5);
	line(65,85,60,95);
	line(60,90,65,105.5);
	line(65,130,65,105.5);
	line(85,125,85,105.5);
	line(75,105.5,75,125);
	line(75,125,78,125);
	line(78,125,78,130);
	line(85,125,88,125);
	line(88,125,88,130);
	line(65,120,85,120);

       /*   le bassin de hcl */

	line(200,350,600,350);

	line(198,315,198,600);
	line(602,315,602,600);
	line(198,479,602,479);
	setcolor(RED);
	for(i=0;i<402;i++)
	   line(200+i,350,200+i,477);

	setcolor(WHITE);
	 setcolor(12);
	 circle(250,320,5);
	 circle(290,325,4);
	 circle(320,330,3);
	 circle(391,320,6);
	 circle(420,331,4);
	 circle(490,320,4);
	 circle(530,326,5);
	 circle(550,320,6);
	 setcolor(WHITE);

       /*    pirate    */
	 circle(610+x,120+h,20);
	 circle(610+x,90+h,10);
	 circle(622+x,85+h,2);
	 circle(615+x,90+h,2);
	 circle(605+x,90+h,1);
	 circle(610+x,118+h,4);
	 line(590+x,120+h,630+x,120+h);
	 line(625+x,85+h,628+x,75+h);
	 line(628+x,75+h,625+x,75+h);
	 line(625+x,75+h,625+x,85+h);
	 line(625+x,95+h,625+x,75+h);
	 line(625+x,95+h,628+x,95+h);
	 line(628+x,95+h,625+x,75+h);
	 line(590+x,115+h,630+x,115+h);

	 line(600+x,85+h,620+x,85+h);
	 line(630+x,150+h,625+x,132+h);
	 line(595+x,132+h,590+x,150+h);
	 for(i=602+x;i<=604+x;i++)
		for(j=120;j<=139;j++)
		{

			line(i,j+h,i,j+h);
		}
	 for(i=615+x;i<=617+x;i++)
		for(j=120;j<=139;j++)
		{

			line(i,j+h,i,j+h);
		}
	 circle(605+x,90+h,1);
	 circle(615+x,90+h,1);
	 circle(605+x,115+h,1);
	 circle(615+x,115+h,1);
	 circle(601+x,105+h,1);
	 circle(619+x,105+h,1);
	 line(601+x,105+h,601+x,105+h);
	 line(601+x,105+h,601+x,105+h);
	 line(605+x,115+h,605+x,115+h);
	 line(615+x,115+h,615+x,115+h);
	 line(595+x,108+h,576+x,116+h);
	  /* objet pirate*/
	 circle(470,117+h,3);
	 line(470,119+h,450,135+h);
	 line(450,135+h,465,150+h);
	 line(450,135+h,435,150+h);
delay(100);
} while(l!=200);

}
  if(bln==1)
     {
	/*G.pirate*/

      circle(400,250,150);
      arc(400,600,20,160,200);
      arc(400,110,205,335,150);
      line(560,150,550,90);
      line(550,90,580,100);
      line(580,100,560,150);
      line(560,150,600,200);
      line(600,200,620,185);
      line(620,185,560,150);
      for(i=0;i<=30;i++)
	{ circle(485,285,30-i);}
      circle(470,145,20);
      circle(545,160,20);
      circle(385,160,20);
      circle(320,200,20);
      circle(335,150,20);
      circle(445,200,20);

      circle(545,160,20);
      line(485,285,520,200);
      line(486,285,521,200);
      line(487,285,522,200);
      line(488,285,523,200);
      line(484,285,295,350);
      line(483,285,294,350);
      line(482,285,293,350);
      line(300,255,350,285);
      pieslice(330,285,0,360,10 );
      line(340,380,360,360);
      line(360,360,380,380);
      line(380,380,400,360);
      line(400,360,420,380);
      line(420,380,440,360);
      line(460,380,440,360);
      }
 getch();
break;
		     /* 2 Joueur*/
			case'b':
cleardevice();
  s=0;
  pr=1;
 /* select the text style */
settextstyle(3, HORIZ_DIR, 1);
/* output a message */
outtextxy(2,10,"combien de nombre vous voulez cacher?");
gotoxy(47,2);
scanf("%d",&N);
 /* select the text style */
settextstyle(3, HORIZ_DIR, 1);
/* output a message */
outtextxy(2, 60,"entrer les nombre que vous voulez cacher:\n");
gotoxy(1,7);
for(i=0;i<N;i++)
   {
     printf("N%d=",i+1);
     scanf("%d",&t[i]);
     s=t[i]+s;
     pr=t[i]*pr;
   }
for(j=0;j<N;j++)
   t2[j]=t[j];

cleardevice();
    /*affichage*/
// for(i=0;i<6;i++)
//    printf("t[%d]=%d \n",i,t[i]);

gotoxy(1,10);
setcolor(5);
printf("la somme est  : %d \n",s);
printf("le produit est: %.0f \n",pr);
printf("le premier nombre est: %d \n",t[0]);
printf("le dernier nombre est: %d \n\n",t[N-1]);
  setcolor(8);
      line(600,200,600,450);
      line(460,450,650,450);
      line(500,200,600,200);
      line(500,200,500,250);

      line(601,200,601,450);
      line(460,451,650,451);
      line(500,201,600,201);
      line(501,200,501,250);
   z=0;
   f=0;
  cp=0;
printf("entrer un nombre: \n");
do
 {
  gotoxy(18,15);
  scanf("%d",&y);
  bln=0;
   for(i=1;i<N-1;i++)
    {
    if(y==t[i])
      {
       z++;
       gotoxy(63+z+z,12.9);
	printf("%d",t2[i]);
	bln=1;
	break;
      }
    }
	if(bln==1)
	{
 //        printf(" bravo ");
	 cp++;
	 t[i]=-1;
	}
	else
	{
	 f++;
	}
      setcolor(15);
	if(f==1)
	{
	circle(500,270,20);
	line(510,260,507,260);
	line(490,260,493,260);
	line(500,268,500,271);
	arc (500,280,30,0,2);
	}
	if(f==2)
	line(500,290,500,350);
	if(f==3)
	line(500,305,480,325);
	if(f==4)
	line(500,305,520,325);
	if(f==5)
	line(500,350,485,380);
	if(f==6)
	line(500,350,515,380);

  }while(f<6 && cp!=N-2);
if(cp==N-2)
{
 cleardevice();
 /* select the text style */
settextstyle(3, HORIZ_DIR, 4);
/* output a message */
outtextxy(getmaxx()/4, getmaxy()/2," vous avez gagn&#8218;");
}
else
{
 cleardevice();
 gotoxy(20,35);
 /* select the text style */
settextstyle(3, HORIZ_DIR, 4);
/* output a message */
 outtextxy(getmaxx()/4, getmaxy()/2,"vous avez perdu");
}
getch();
break;

 case'c':break;
}

cleardevice();
 /* select the text style */
settextstyle(3, HORIZ_DIR, 4);
/* output a message */
outtextxy(getmaxx()/8, getmaxy()/2,"Voulez-vous quitter le jeu O/N ?");

rep=getch();
}while(rep=='N'||rep=='n');
   closegraph();
   return 0;
}

Conclusion :


c'est mon premier mini-projet en langage C ( je suis en 1ere année dans une école d'ingénieurs au Maroc ) et je serai ravi de savoir vos avis sur ce programme et quelque conseils que vous voyez utiles pour un débutant et MERCI d'avance.

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.