الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

كيفية استعمال الماوس في Turbo C

بدأه 4algeria.inf في 8 ديسمبر 2008 · 1 رد · 593 مشاهدة · في لغة C و ++C
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

بســم الله الـرحمــن الرحيــم

هدا البرنامج انا كتبت من حوالي 5 سنوات هو يرسم نافدة ادخال كلمة السر في دوس مع برمجة الفأرة طبعا. جربوه

البرنامج التنفيدي في المرفقات

  1. #include "graphics.h"

  2. #include "dos.h"
  3. #include "string.h"
  4. #include "stdlib.h"
  5. #include "conio.h"
  6. #include "ctype.h"
  7. #include "stdio.h"
  8. //-------------------------------------------------------------------//
  9. union REGS registre;
  10. struct REGPACK reg;
  11. //-------------------------------------------------------------------//
  12. const int CLICK = 1;
  13. const int PAINT = 2;
  14. const int mbOk = 1;
  15. const int mbExit = 2;
  16. //-------------------------------------------------------------------//
  17. int choix_1,choix_2,choix_3,choix_4,signal;
  18. char nbre[20];
  19. double List[10];
  20. //-------------------------------------------------------------------//
  21. enum boolean {
  22. false = 0,
  23. true = 1
  24. };
  25. //-------------------------------------------------------------------//
  26. boolean mouse(int x,int y,int maxx,int maxy)
  27. {
  28. reg.r_ax = 3;
  29. intr(0x33,&reg);
  30. if(reg.r_cx<=maxx && reg.r_cx>=x && reg.r_dx<=maxy && reg.r_dx>=y)
  31. return true;
  32. else
  33. return false;
  34. }
  35. //--------------------------------------------------------------------//
  36. void show()
  37. {
  38. registre.x.ax = 1;
  39. int86(0x33,&registre,&registre);
  40. }
  41. //--------------------------------------------------------------------//
  42. void hide()
  43. {
  44. reg.r_ax = 2;
  45. intr(0x33,&reg);
  46. }
  47. //--------------------------------------------------------------------//
  48. int init_mouse()
  49. {
  50. reg.r_ax = 0;
  51. intr(0x33,&reg);
  52. return reg.r_ax;
  53. }
  54. //--------------------------------------------------------------------//
  55. boolean clic(int x,int y,int maxx,int maxy)
  56. {
  57. registre.x.ax = 3;
  58. int86(0x33,&registre,&registre);
  59. if(mouse(x,y,maxx,maxy) && registre.x.bx==1)
  60. return true;
  61. else
  62. return false;
  63. }
  64. //-------------------------------------------------------------------//
  65. void separator(int x,int y,int larg)
  66. {
  67. hide();
  68. setcolor(8);
  69. line(x,y,x+larg,y);
  70. setcolor(15);
  71. line(x,y+1,x+larg,y+1);
  72. show();
  73. }
  74. //-------------------------------------------------------------------//
  75. void BUTTON_OK(int x,int y,char *nom_buttom)
  76. {
  77. hide();
  78. setcolor(10);
  79. line(x+5,y+13,x+10,y+17);
  80. line(x+10,y+17,x+20,y+5);
  81. line(x+6,y+13,x+10,y+16);
  82. line(x+7,y+13,x+10,y+15);
  83. line(x+10,y+16,x+19,y+5);
  84. line(x+10,y+15,x+18,y+5);
  85. setcolor(8);
  86. line(x+4,y+12,x+8,y+12);
  87. line(x+17,y+4,x+21,y+4);
  88. line(x+4,y+12,x+10,y+18);
  89. line(x+8,y+12,x+10,y+14);
  90. line(x+10,y+14,x+17,y+4);
  91. line(x+21,y+4,x+10,y+18);
  92. setcolor(0);
  93. outtextxy(x+28,y+5,nom_buttom);
  94. show();
  95. }
  96. //--------------------------------------------------------------------//
  97. void BUTTON_EXIT(int x,int y,char *nom_buttom)
  98. {
  99. hide();
  100. setfillstyle(1,4);
  101. fillellipse(x+13,y+10,7,7);
  102. setcolor(15);
  103. line(x+8,y+6,x+16,y+14);
  104. line(x+16,y+6,x+8,y+14);
  105. line(x+9,y+6,x+17,y+14);
  106. line(x+10,y+6,x+18,y+14);
  107. line(x+17,y+6,x+9,y+14);
  108. line(x+18,y+6,x+10,y+14);
  109. setcolor(0);
  110. outtextxy(x+29,y+5,nom_buttom);
  111. circle(x+13,y+10,7);
  112. show();
  113. }
  114. //-------------------------------------------------------------------//
  115. void init_graph()
  116. {
  117. if(init_mouse() != -1)
  118. {
  119. exit(1);
  120. }
  121. else
  122. {
  123. int gdriver = DETECT, gmode;
  124. initgraph(&gdriver, &gmode, "");
  125. }
  126. }
  127. //-------------------------------------------------------------------//
  128. void setfont(int x,int y)
  129. {
  130. settextstyle(x,0,y);
  131. }
  132. //-------------------------------------------------------------------//
  133. void windows(int x,int y,int larg,int haut,char *titre)
  134. {
  135. hide();
  136. setfillstyle(1,7);
  137. bar(x,y,x+larg,y+haut);
  138. setcolor(15);
  139. line(x,y,x,y+haut);
  140. line(x,y,x+larg,y);
  141. setcolor(0);
  142. line(x+larg,y+haut,x+larg,y);
  143. line(x+larg,y+haut,x,y+haut);
  144. setfillstyle(1,1);
  145. bar(x,y-16,x+larg+10,y);
  146. setfillstyle(1,1);
  147. fillellipse(x+larg+10,y-8,8,8);
  148. setcolor(1);
  149. circle(x+larg+10,y-8,8);
  150. setfillstyle(1,4);
  151. fillellipse(x,y-8,17,17);
  152. int xx = x-10,yy = y-17;
  153. setcolor(4);
  154. circle(x,y-8,17);
  155. setfillstyle(1,7);
  156. bar(xx,yy,xx+19,yy+16);
  157. setfillstyle(1,1);
  158. bar(xx,yy,xx+19,yy+4);
  159. setcolor(0);
  160. line(xx+19,yy+16,xx+19,yy);
  161. line(xx+19,yy+16,xx,yy+16);
  162. setcolor(15);
  163. line(xx,yy,xx+19,yy);
  164. line(xx,yy,xx,yy+16);
  165. setcolor(15);
  166. outtextxy(x+25,y-14,titre);
  167. show();
  168. }
  169. //--------------------------------------------------------------------//
  170. void text_edit(int x,int y,int largeur,int hauteur)
  171. {
  172. hide();
  173. setfillstyle(1,15);
  174. bar(x,y,x+largeur,y+hauteur);
  175. setcolor(0);
  176. line(x,y,x,y+hauteur);
  177. line(x,y,x+largeur,y);
  178. setcolor(15);
  179. line(x+largeur,y+hauteur,x+largeur,y);
  180. line(x+largeur,y+hauteur,x,y+hauteur);
  181. show();
  182. }
  183. //--------------------------------------------------------------------//
  184. void label(char *titre,int x,int y,int color)
  185. {
  186. hide();
  187. setcolor(color);
  188. outtextxy(x,y,titre);
  189. show();
  190. }
  191. //--------------------------------------------------------------------//
  192. void border(int x,int y,int maxx,int maxy)
  193. {
  194. hide();
  195. setcolor(15);
  196. line(x+1,y+1,maxx,y+1);
  197. line(x,y+1,maxx-1,y+1);
  198. line(x+1,y+1,x+1,maxy-1);
  199. line(maxx+1,maxy+1,maxx+1,y);
  200. line(maxx+1,maxy+1,x,maxy+1);
  201. setcolor(8);
  202. line(x,y,maxx,y);
  203. line(x,y,maxx,y);
  204. line(maxx,y,maxx,maxy);
  205. line(maxx,maxy,x,maxy);
  206. line(x,maxy,x,y);
  207. show();
  208. }
  209. //--------------------------------------------------------------------//
  210. void page_arriere(int background)
  211. {
  212. hide();
  213. setfillstyle(1,background);
  214. bar(0,0,getmaxx(),getmaxy());
  215. show();
  216. }
  217. //-------------------------------------------------------------------//
  218. void button(char *nom_buttom,int x,int y,int maxx,int maxy,int cause_appel,int type_button)
  219. {
  220. hide();
  221. setfillstyle(1,7);
  222. bar(x,y,maxx,maxy);
  223. switch(cause_appel)
  224. {
  225. case PAINT : setcolor(0);
  226. line(maxx,maxy,maxx,y);
  227. line(maxx,maxy,x,maxy);
  228. line(maxx-1,maxy-1,maxx-1,y);
  229. line(maxx-1,maxy-1,x,maxy-1);
  230. line(x,y,maxx,y);
  231. line(x,y,x,maxy);
  232. setcolor(15);
  233. line(x+1,y+1,x+1,maxy-1);
  234. line(x+1,y+1,maxx-1,y+1);
  235. break;
  236. case CLICK : setcolor(0);
  237. rectangle(x,y,maxx,maxy);
  238. rectangle(x+1,y+1,maxx-1,maxy-1);
  239. setcolor(15);
  240. line(maxx,maxy,maxx,y);
  241. line(maxx,maxy,x,maxy);
  242. break;
  243. }
  244. setcolor(0);
  245. switch(type_button)
  246. {
  247. case 1 : BUTTON_OK(x,y,nom_buttom);
  248. break;
  249. case 2 : BUTTON_EXIT(x,y,nom_buttom);
  250. break;
  251. case 0 : outtextxy(x+20,y+((maxy-y)/2)-6,nom_buttom);
  252. break;
  253. }
  254. show();
  255. }
  256. //--------------------------------------------------------------------//
  257. void radiobutton(int x,int y,int cause)
  258. {
  259. hide();
  260. setcolor(15);
  261. for(int hj = 5 ; hj > -1 ; hj--)
  262. {
  263. circle(x,y,hj);
  264. }
  265. circle(x,y,4);
  266. circle(x,y,5);
  267. setcolor(0);
  268. arc(x,y,45,225,4);
  269. arc(x,y,45,225,5);
  270. switch(cause)
  271. {
  272. case PAINT : setcolor(15);
  273. for(int j=3;j!=-1;j--)
  274. {
  275. circle(x,y,j);
  276. }
  277. break;
  278. case CLICK : setcolor(0);
  279. for(int k=0;k!=2;k++)
  280. {
  281. circle(x,y,k);
  282. }
  283. break;
  284. }
  285. show();
  286. }
  287. //--------------------------------------------------------------------//
  288. void panel(int x,int y,int larg,int haut,int color)
  289. {
  290. hide();
  291. setfillstyle(1,color);
  292. bar(x,y,x+larg,y+haut);
  293. show();
  294. }
  295. //--------------------------------------------------------------------//
  296. void Warning(int x,int y,char *titre,char *message)
  297. {
  298. show();
  299. setfont(2,4);
  300. windows(x,y,300,120,titre);
  301. button("Ok",x+120,y+90,x+180,y+111,PAINT,mbOk);
  302. hide();
  303. setcolor(0);
  304. outtextxy(x+70,y+40,message);
  305. int x1=x+35,y1=y+45,x_centre=x+35,y_centre=y+55,rayon=25;
  306. setfillstyle(1,14);
  307. fillellipse(x1,y1,rayon,rayon);
  308. setcolor(0);
  309. circle(x+35,y+45,25);
  310. setfillstyle(1,0);
  311. fillellipse(x_centre,y_centre+5,4,4);
  312. setfillstyle(1,0);
  313. bar(x+31,y+24,x+38,y+51);
  314. show();
  315. while(1)
  316. {
  317. if(clic(x+120,y+90,x+180,y+111))
  318. {
  319. button("Ok",x+120,y+90,x+180,y+111,CLICK,mbOk);
  320. sound(570);
  321. delay(80);
  322. nosound();
  323. button("Ok",x+120,y+90,x+180,y+111,PAINT,mbOk);
  324. return;
  325. }
  326. }
  327. }
  328. //--------------------------------------------------------------------//
  329. void generator_aleatoire(int x,int y)
  330. {
  331. windows(x,y,250,80,"Initialisation ...");
  332. label("Initialiser Le Gen‚rateur Al‚atoire ...",x+10,y+15,0);
  333. text_edit(x+10,y+40,230,15);
  334. setfillstyle(1,4);
  335. for(int i = x+10 ; i <= x+240 ; i += 10)
  336. {
  337. hide();
  338. bar(x+10,y+41,i,y+54);
  339. show();
  340. delay(90);
  341. }
  342. for(i = 0 ; i < 10 ; i++)
  343. {
  344. List[i] = 0.0;
  345. }
  346. randomize();
  347. delay(150);
  348. return;
  349. }
  350. //--------------------------------------------------------------------//
  351. void saisie_aleatoire(int x,int y)
  352. {
  353. windows(x,y,270,100,"Nombre Al‚atoire ...");
  354. label("Saisie Le Nbre De Nombres Al‚atoire : ",x+15,y+12,0);
  355. text_edit(x+15,y+35,235,15);
  356. button("Ok",x+50,y+68,x+110,y+89,PAINT,mbOk);
  357. button("Cls",x+160,y+68,x+220,y+89,PAINT,mbExit);
  358. show();
  359. char car;
  360. char *mot = new char[2];
  361. int i = 1,cor_x = x+15,cor_y = y+37;
  362. nbre[0] = '\0';
  363. setcolor(4);
  364. while(1)
  365. {
  366. if(clic(x+50,y+68,x+110,y+89))
  367. {
  368. button("Ok",x+50,y+68,x+110,y+89,CLICK,mbOk);
  369. sound(550);
  370. delay(80);
  371. nosound();
  372. button("Ok",x+50,y+68,x+110,y+89,PAINT,mbOk);
  373. if(nbre[0] == '\0');
  374. else
  375. {
  376. for(int j = 0 ; j < 10 ; j++)
  377. {
  378. List[j] = (double) rand() / RAND_MAX;
  379. }
  380. return;
  381. }
  382. }
  383. if(clic(x+160,y+68,x+220,y+89))
  384. {
  385. button("Cls",x+160,y+68,x+220,y+89,CLICK,mbExit);
  386. sound(550);
  387. delay(80);
  388. nosound();
  389. button("Cls",x+160,y+68,x+220,y+89,PAINT,mbExit);
  390. text_edit(x+15,y+35,235,15);
  391. nbre[0] = '\0';
  392. cor_x = x+15;
  393. cor_y = y+37;
  394. i = 1;
  395. }
  396. ali : if(kbhit())
  397. {
  398. car = getch();
  399. if(!iscntrl(car) && isdigit(car))
  400. {
  401. setcolor(0);
  402. cor_x += 7;
  403. *(mot+0) = car;
  404. *(mot+1) = '\0';
  405. hide();
  406. outtextxy(cor_x,cor_y,mot);
  407. show();
  408. if(i == 1)
  409. {
  410. strcpy(nbre,mot);
  411. i++;
  412. }
  413. else
  414. {
  415. strcat(nbre,mot);
  416. }
  417. }
  418. else
  419. {
  420. car = 'a';
  421. }
  422. }
  423. }
  424. }
  425. //--------------------------------------------------------------------//
  426. void secteur_3D(int x,int y,double valeur)
  427. {
  428. hide();
  429. setcolor(0);
  430. int xy = y+13;
  431. for(int i = 13 ; i > 0 ; i--)
  432. {
  433. ellipse(x,xy,0,360,65,35);
  434. xy--;
  435. }
  436. setfillstyle(1,1);
  437. sector(x,y,0,360,65,35);
  438. setcolor(1);
  439. line(x,y,x+65,y);
  440. int val = valeur * 100;
  441. int angle = (int) (val * 360) / 100;
  442. if(angle < 0)
  443. {
  444. int k = -1 * angle;
  445. angle = k;
  446. }
  447. setfillstyle(1,4);
  448. sector(x,y,0,angle,65,35);
  449. setcolor(4);
  450. sector(x,y,0,angle,65,35);
  451. show();
  452. }
  453. //--------------------------------------------------------------------//
  454. int aleatoire_vide()
  455. {
  456. int fois = 0;
  457. for(int k = 0 ; k < 10 ; k++)
  458. {
  459. if(List[k] != 0)
  460. {
  461. fois++;
  462. }
  463. }
  464. return fois;
  465. }
  466. //--------------------------------------------------------------------//
  467. char * flaot_to_str(double val)
  468. {
  469. char *string,*virgule;
  470. int precision = 8,decimale,signe;
  471. strcpy(virgule,"0.");
  472. string = fcvt(val, precision, &decimale, &signe);
  473. strcat(virgule,string);
  474. return virgule;
  475. }
  476. //--------------------------------------------------------------------//
  477. void graphisme_aleatoire(int x,int y)
  478. {
  479. windows(x,y,300,210,"Graphisme ...");
  480. border(x+10,y+10,x+130,y+180);
  481. hide();
  482. setcolor(7);
  483. line(x+14,y+10,x+14+textwidth("Valeur")+6,y+10);
  484. line(x+14,y+11,x+14+textwidth("Valeur")+6,y+11);
  485. setcolor(1);
  486. outtextxy(x+14,y+6," Valeur ");
  487. show();
  488. border(x+140,y+10,x+290,y+180);
  489. hide();
  490. setcolor(7);
  491. line(x+144,y+10,x+144+textwidth("Graphe")+8,y+10);
  492. line(x+144,y+11,x+144+textwidth("Graphe")+8,y+11);
  493. setcolor(4);
  494. outtextxy(x+144,y+6," Graphe ");
  495. show();
  496. text_edit(x+20,y+20,100,150);
  497. button("Ok",x+230,y+185,x+290,y+206,PAINT,mbOk);
  498. panel(x+150,y+160,10,10,1);
  499. hide();
  500. setcolor(0);
  501. rectangle(x+150,y+160,x+160,y+170);
  502. show();
  503. panel(x+150,y+145,10,10,4);
  504. hide();
  505. setcolor(0);
  506. rectangle(x+150,y+145,x+160,y+155);
  507. show();
  508. label(" % Al‚atoire ...",x+165,y+145,0);
  509. label(" % Qui Reste ...",x+165,y+160,0);
  510. int var = y+22;
  511. char *string,*virgule;
  512. for(int i = 0 ; i < 10 ; i++)
  513. {
  514. label(flaot_to_str(List[i]),x+28,var,0);
  515. var += 15;
  516. delay(120);
  517. }
  518. while(1)
  519. {
  520. if(clic(x+230,y+185,x+290,y+206))
  521. {
  522. button("Ok",x+230,y+185,x+290,y+206,CLICK,mbOk);
  523. sound(520);
  524. delay(80);
  525. nosound();
  526. button("Ok",x+230,y+185,x+290,y+206,PAINT,mbOk);
  527. return;
  528. }
  529. if(clic(x+20,y+20,x+120,y+35))
  530. {
  531. text_edit(x+20,y+20,100,150);
  532. var = y+22;
  533. for(int i = 0 ; i < 10 ; i++)
  534. {
  535. label(flaot_to_str(List[i]),x+28,var,0);
  536. var += 15;
  537. }
  538. panel(x+21,y+21,99,14,1);
  539. label(flaot_to_str(List[0]),x+28,y+22,15);
  540. panel(x+150,y+20,130,120,7);
  541. secteur_3D(x+215,y+70,List[0]);
  542. }
  543. if(clic(x+20,y+35,x+120,y+50))
  544. {
  545. text_edit(x+20,y+20,100,150);
  546. var = y+22;
  547. for(int i = 0 ; i < 10 ; i++)
  548. {
  549. label(flaot_to_str(List[i]),x+28,var,0);
  550. var += 15;
  551. }
  552. panel(x+21,y+36,99,14,1);
  553. label(flaot_to_str(List[1]),x+28,y+37,15);
  554. panel(x+150,y+20,130,120,7);
  555. secteur_3D(x+215,y+70,List[1]);
  556. }
  557. if(clic(x+20,y+50,x+120,y+65))
  558. {
  559. text_edit(x+20,y+20,100,150);
  560. var = y+22;
  561. for(int i = 0 ; i < 10 ; i++)
  562. {
  563. label(flaot_to_str(List[i]),x+28,var,0);
  564. var += 15;
  565. }
  566. panel(x+21,y+51,99,14,1);
  567. label(flaot_to_str(List[2]),x+28,y+52,15);
  568. panel(x+150,y+20,130,120,7);
  569. secteur_3D(x+215,y+70,List[2]);
  570. }
  571. if(clic(x+20,y+65,x+120,y+80))
  572. {
  573. text_edit(x+20,y+20,100,150);
  574. var = y+22;
  575. for(int i = 0 ; i < 10 ; i++)
  576. {
  577. label(flaot_to_str(List[i]),x+28,var,0);
  578. var += 15;
  579. }
  580. panel(x+21,y+66,99,14,1);
  581. label(flaot_to_str(List[3]),x+28,y+67,15);
  582. panel(x+150,y+20,130,120,7);
  583. secteur_3D(x+215,y+70,List[3]);
  584. }
  585. if(clic(x+20,y+80,x+120,y+95))
  586. {
  587. text_edit(x+20,y+20,100,150);
  588. var = y+22;
  589. for(int i = 0 ; i < 10 ; i++)
  590. {
  591. label(flaot_to_str(List[i]),x+28,var,0);
  592. var += 15;
  593. }
  594. panel(x+21,y+81,99,14,1);
  595. label(flaot_to_str(List[4]),x+28,y+82,15);
  596. panel(x+150,y+20,130,120,7);
  597. secteur_3D(x+215,y+70,List[4]);
  598. }
  599. if(clic(x+20,y+95,x+120,y+110))
  600. {
  601. text_edit(x+20,y+20,100,150);
  602. var = y+22;
  603. for(int i = 0 ; i < 10 ; i++)
  604. {
  605. label(flaot_to_str(List[i]),x+28,var,0);
  606. var += 15;
  607. }
  608. panel(x+21,y+97,99,14,1);
  609. label(flaot_to_str(List[5]),x+28,y+97,15);
  610. panel(x+150,y+20,130,120,7);
  611. secteur_3D(x+215,y+70,List[5]);
  612. }
  613. if(clic(x+20,y+110,x+120,y+125))
  614. {
  615. text_edit(x+20,y+20,100,150);
  616. var = y+22;
  617. for(int i = 0 ; i < 10 ; i++)
  618. {
  619. label(flaot_to_str(List[i]),x+28,var,0);
  620. var += 15;
  621. }
  622. panel(x+21,y+111,99,14,1);
  623. label(flaot_to_str(List[6]),x+28,y+112,15);
  624. panel(x+150,y+20,130,120,7);
  625. secteur_3D(x+215,y+70,List[6]);
  626. }
  627. if(clic(x+20,y+125,x+120,y+140))
  628. {
  629. text_edit(x+20,y+20,100,150);
  630. var = y+22;
  631. for(int i = 0 ; i < 10 ; i++)
  632. {
  633. label(flaot_to_str(List[i]),x+28,var,0);
  634. var += 15;
  635. }
  636. panel(x+21,y+126,99,14,1);
  637. label(flaot_to_str(List[7]),x+28,y+127,15);
  638. panel(x+150,y+20,130,120,7);
  639. secteur_3D(x+215,y+70,List[7]);
  640. }
  641. if(clic(x+20,y+140,x+120,y+155))
  642. {
  643. text_edit(x+20,y+20,100,150);
  644. var = y+22;
  645. for(int i = 0 ; i < 10 ; i++)
  646. {
  647. label(flaot_to_str(List[i]),x+28,var,0);
  648. var += 15;
  649. }
  650. panel(x+21,y+141,99,14,1);
  651. label(flaot_to_str(List[8]),x+28,y+142,15);
  652. panel(x+150,y+20,130,120,7);
  653. secteur_3D(x+215,y+70,List[8]);
  654. }
  655. if(clic(x+20,y+155,x+120,y+170))
  656. {
  657. text_edit(x+20,y+20,100,150);
  658. var = y+22;
  659. for(int i = 0 ; i < 10 ; i++)
  660. {
  661. label(flaot_to_str(List[i]),x+28,var,0);
  662. var += 15;
  663. }
  664. panel(x+21,y+156,99,14,1);
  665. label(flaot_to_str(List[9]),x+28,y+157,15);
  666. panel(x+150,y+20,130,120,7);
  667. secteur_3D(x+215,y+70,List[9]);
  668. }
  669. }
  670. }
  671. //--------------------------------------------------------------------//
  672. void menu_principal(int x,int y)
  673. {
  674. page_arriere(3);
  675. windows(x,y,350,250,"Interface ...");
  676. panel(x,y+1,350,30,0);
  677. hide();
  678. setfillstyle(1,4);
  679. fillellipse(x,y-8,17,17);
  680. setcolor(4);
  681. circle(x,y-8,17);
  682. int xx = x-10,yy = y-17;
  683. setfillstyle(1,7);
  684. bar(xx,yy,xx+19,yy+16);
  685. setfillstyle(1,1);
  686. bar(xx,yy,xx+19,yy+4);
  687. setcolor(0);
  688. line(xx+19,yy+16,xx+19,yy);
  689. line(xx+19,yy+16,xx,yy+16);
  690. setcolor(15);
  691. line(xx,yy,xx+19,yy);
  692. line(xx,yy,xx,yy+16);
  693. show();
  694. label(" Menu Principal ...",x+5,y+10,11);
  695. panel(x,y+32,140,178,1);
  696. label(" Tp Modilisation ...",x+2,y+50,15);
  697. label(" Nombres Al‚atoire ",x+3,y+70,2);
  698. label(" R‚aliser Par : ",x+2,y+90,15);
  699. label(" Rebai Abdelhalim ",x+3,y+110,2);
  700. label(" Boulemdaisse Moncef ",x+2,y+130,2);
  701. label(" Groupe : ",x+2,y+150,15);
  702. label(" 6 , 7 ",x+70,y+150,2);
  703. panel(x,y+210,350,40,0);
  704. label("Disription De Services ... ",x+10,y+213,14);
  705. panel(x+145,y+35,70,15,6);
  706. setcolor(0);
  707. rectangle(x+145,y+35,x+145+70,y+35+15);
  708. label("Services : ",x+149,y+36,15);
  709. separator(x+220,y+42,120);
  710. separator(x+145,y+170,195);
  711. button("Ok",x+170,y+180,x+230,y+201,PAINT,1);
  712. button("Exit",x+260,y+180,x+320,y+201,PAINT,2);
  713. radiobutton(x+152,y+75,PAINT);
  714. label(" Initialisation ...",x+164,y+69,1);
  715. radiobutton(x+152,y+100,PAINT);
  716. label(" Nombre Al‚atoire ...",x+164,y+94,1);
  717. radiobutton(x+152,y+125,PAINT);
  718. label(" Graphisme Al‚atoire ...",x+164,y+119,1);
  719. radiobutton(x+152,y+150,PAINT);
  720. label(" Quitter L'Application ...",x+164,y+144,1);
  721. while(1)
  722. {
  723. if(clic(x+147,y+70,x+157,y+80))
  724. {
  725. choix_1 = 1;
  726. choix_2 = 0;
  727. choix_3 = 0;
  728. choix_4 = 0;
  729. signal = 1;
  730. radiobutton(x+152,y+75,CLICK);
  731. label(" Initialisation ...",x+164,y+69,4);
  732. label(" Nombre Al‚atoire ...",x+164,y+94,1);
  733. label(" Graphisme Al‚atoire ...",x+164,y+119,1);
  734. label(" Quitter L'Application ...",x+164,y+144,1);
  735. panel(x+5,y+226,330,17,0);
  736. label("Initialiser Le G‚nerateur De Nombres Psoudo Al‚atoire ...",x+10,y+230,11);
  737. radiobutton(x+152,y+100,PAINT);
  738. radiobutton(x+152,y+125,PAINT);
  739. radiobutton(x+152,y+150,PAINT);
  740. }
  741. if(clic(x+147,y+95,x+157,y+105))
  742. {
  743. choix_2 = 1;
  744. choix_1 = 0;
  745. choix_3 = 0;
  746. choix_4 = 0;
  747. radiobutton(x+152,y+100,CLICK);
  748. label(" Nombre Al‚atoire ...",x+164,y+94,4);
  749. label(" Initialisation ...",x+164,y+69,1);
  750. label(" Graphisme Al‚atoire ...",x+164,y+119,1);
  751. label(" Quitter L'Application ...",x+164,y+144,1);
  752. panel(x+5,y+226,330,17,0);
  753. label("Determiner Le Nbre Des Nombres Psoudo Al‚atoire ...",x+10,y+230,11);
  754. radiobutton(x+152,y+75,PAINT);
  755. radiobutton(x+152,y+125,PAINT);
  756. radiobutton(x+152,y+150,PAINT);
  757. }
  758. if(clic(x+147,y+120,x+157,y+130))
  759. {
  760. choix_2 = 0;
  761. choix_1 = 0;
  762. choix_3 = 1;
  763. choix_4 = 0;
  764. radiobutton(x+152,y+125,CLICK);
  765. label(" Nombre Al‚atoire ...",x+164,y+94,1);
  766. label(" Initialisation ...",x+164,y+69,1);
  767. label(" Graphisme Al‚atoire ...",x+164,y+119,4);
  768. label(" Quitter L'Application ...",x+164,y+144,1);
  769. panel(x+5,y+226,330,17,0);
  770. label("Repr‚sentation Graphique Pour Les Nombres Al‚atoire ...",x+10,y+230,11);
  771. radiobutton(x+152,y+75,PAINT);
  772. radiobutton(x+152,y+100,PAINT);
  773. radiobutton(x+152,y+150,PAINT);
  774. }
  775. if(clic(x+147,y+145,x+157,y+155))
  776. {
  777. choix_2 = 0;
  778. choix_1 = 0;
  779. choix_3 = 0;
  780. choix_4 = 1;
  781. radiobutton(x+152,y+150,CLICK);
  782. label(" Nombre Al‚atoire ...",x+164,y+94,1);
  783. label(" Initialisation ...",x+164,y+69,1);
  784. label(" Graphisme Al‚atoire ...",x+164,y+119,1);
  785. label(" Quitter L'Application ...",x+164,y+144,4);
  786. panel(x+5,y+226,330,17,0);
  787. label("Terminer L'Execution Du Programme ...",x+10,y+230,11);
  788. radiobutton(x+152,y+75,PAINT);
  789. radiobutton(x+152,y+100,PAINT);
  790. radiobutton(x+152,y+125,PAINT);
  791. }
  792. if(clic(x+260,y+180,x+320,y+201))
  793. {
  794. button("Exit",x+260,y+180,x+320,y+201,CLICK,2);
  795. sound(570);
  796. delay(80);
  797. nosound();
  798. button("Exit",x+260,y+180,x+320,y+201,PAINT,2);
  799. radiobutton(x+152,y+75,PAINT);
  800. radiobutton(x+152,y+100,PAINT);
  801. radiobutton(x+152,y+125,PAINT);
  802. radiobutton(x+152,y+150,PAINT);
  803. label(" Nombre Al‚atoire ...",x+164,y+94,1);
  804. label(" Initialisation ...",x+164,y+69,1);
  805. label(" Graphisme Al‚atoire ...",x+164,y+119,1);
  806. label(" Quitter L'Application ...",x+164,y+144,1);
  807. choix_1 = 0;
  808. choix_2 = 0;
  809. choix_3 = 0;
  810. choix_4 = 0;
  811. for(int hp = 0 ; hp < 10 ; hp++)
  812. {
  813. List[hp] = 0;
  814. }
  815. signal = 0;
  816. }
  817. if(clic(x+170,y+180,x+230,y+201))
  818. {
  819. button("Ok",x+170,y+180,x+230,y+201,CLICK,1);
  820. sound(570);
  821. delay(80);
  822. nosound();
  823. button("Ok",x+170,y+180,x+230,y+201,PAINT,1);
  824. if(choix_1)
  825. {
  826. generator_aleatoire(170,170);
  827. menu_principal(120,95);
  828. signal = 1;
  829. }
  830. if(choix_4)
  831. {
  832. for(int h = 0 ; h < 10 ; h++)
  833. {
  834. List[h] = 0;
  835. }
  836. signal = 0;
  837. exit(1);
  838. }
  839. if(choix_2 && signal == 1)
  840. {
  841. saisie_aleatoire(160,160);
  842. menu_principal(120,95);
  843. }
  844. if(choix_3 && aleatoire_vide() != 0)
  845. {
  846. graphisme_aleatoire(190,160);
  847. menu_principal(120,95);
  848. }
  849. }
  850. }
  851. }
  852. //--------------------------------------------------------------------//
  853. void Password(int x,int y)
  854. {
  855. page_arriere(0);
  856. windows(x,y,270,100,"S‚curite : Password");
  857. label("Le Mot De Passe Pour Continue : ",x+15,y+12,0);
  858. text_edit(x+15,y+35,235,15);
  859. button("Ok",x+50,y+68,x+110,y+89,PAINT,mbOk);
  860. button("Exit",x+160,y+68,x+220,y+89,PAINT,mbExit);
  861. show();
  862. char password[20],car;
  863. char *mot = new char[2];
  864. int i = 1,cor_x = x+20,cor_y = y+37;
  865. password[0] = '\0';
  866. setcolor(4);
  867. while(1)
  868. {
  869. if(clic(x+50,y+68,x+110,y+89))
  870. {
  871. button("Ok",x+50,y+68,x+110,y+89,CLICK,mbOk);
  872. sound(570);
  873. delay(80);
  874. nosound();
  875. button("Ok",x+50,y+68,x+110,y+89,PAINT,mbOk);
  876. if(strcmpi(password,"Algeria") == 0)
  877. {
  878. menu_principal(120,95);
  879. }
  880. else
  881. {
  882. text_edit(x+15,y+35,235,15);
  883. password[0] = '\0';
  884. cor_x = x+20;
  885. cor_y = y+37;
  886. goto ali;
  887. }
  888. }
  889. if(clic(x+160,y+68,x+220,y+89))
  890. {
  891. button("Exit",x+160,y+68,x+220,y+89,CLICK,mbExit);
  892. sound(570);
  893. delay(80);
  894. nosound();
  895. button("Exit",x+160,y+68,x+220,y+89,PAINT,mbExit);
  896. }
  897. ali : if(kbhit())
  898. {
  899. car = getch();
  900. if(!iscntrl(car))
  901. {
  902. setcolor(1);
  903. hide();
  904. outtextxy(cor_x,cor_y,"*");
  905. show();
  906. cor_x += 7;
  907. *(mot+0) = car;
  908. *(mot+1) = '\0';
  909. if(i == 1)
  910. {
  911. strcpy(password,mot);
  912. i++;
  913. }
  914. else
  915. {
  916. strcat(password,mot);
  917. }
  918. }
  919. }
  920. }
  921. }
  922. //--------------------------------------------------------------------//
  923. void intialisation()
  924. {
  925. choix_1 = 0;
  926. choix_2 = 0;
  927. choix_3 = 0;
  928. choix_4 = 0;
  929. signal = 0;
  930. nbre[0] = '\0';
  931. init_graph();
  932. show();
  933. setfont(2,4);
  934. }
  935. //--------------------------------------------------------------------//
  936. void main()
  937. {
  938. intialisation();
  939. Password(160,160);
  940. getch();
  941. }
  942. //-------------------------------------------------------------------//
  943.  
  944.  
  945.  

Algeria.rar

تم تعديل هذه المشاركة بواسطة djug في 8 ديسمبر 2008 في 21:02

#2

جميل جدا اخي هذا الكود مشاركة طيبة وفقك الله.

tvquran_6.gif

مواضيع مشابهة