Algoritmi de sortare - Borland C++ 3.1

Această secţiune se ocupă cu programarea, fără a ţine cont de limbaj. Dacă vrei (sau trebuie) să înveți algoritmică, aici este locul potrivit. Descrieri şi idei de algoritmi, algoritmi clasici și întrebări pe baza acestora, toate vor fi postate aici.

Algoritmi de sortare - Borland C++ 3.1

Postby DarkByte » 19 Mar 2010, 01:28

Primul examen de C din primul an de facultate l-am trecut pe "ochi frumosi" ... proful ne-a anuntat ca daca ne e lene sa participam la laboratoare, sau daca dam prea multe indicatii colegilor (s-a uitat la mine :-s), putem sari peste prezenta de la laboratoare, venind la examen cu un program a carui tema ne-o va da el. M-am oferit voluntar (mai mult pentru a evita sa ma arunce pe coridor :D) si mi-a dat, ca tema a programului, algoritmi de sortare. Trebuia sa ma prezint la examen cu un program care sa aiba implementati minim 4 algoritmi de sortare pentru o nota de trecere. Pentru nota 10 trebuia sa dau si explicatiile aferente ;)) ... pacat ca acum nu mai inteleg chiar tot ce se intampla pe acolo, decat daca stau sa-mi chinui neuronul ...

Programul l-am scris in Borland C++ 3.1 (you know, the DOS version :P) si ofera un meniu interactiv (cu afisari direct in memoria video) care poate fi folosit cu sagetile sau cu mouse-ul, 7 algoritmi de sortare (initial erau doar 6) si doua metode de interschimbare.

O imagine din timpul rularii programului:
algoritmi sortare meniu C++


Have fun :)

  1. /*  CREATED  : 17.11.2002
  2.     MODIFIED : 05.03.2004 (added Shaker-Sort)
  3.  
  4.     ALGORITMI DE SORTARE
  5.     --------------------
  6.   Program care implementeaza mai multi algoritmi de sortare asupra unui
  7. vector de numere intregi. Au fost implementati algoritmii:
  8.  
  9.  1. Bubble-Sort (metoda bulelor)
  10.  2. Quick-Sort (sortare rapida)
  11.  3. Sortare prin numarare
  12.  4. Sortare prin insertie
  13.  5. Shell-Sort (h-sortare)
  14.  6. Sortare prin interschimbare
  15.  7. Shaker-Sort
  16.  
  17.   Interschimbarea a doua numere a fost realizata in doua variante, una care
  18. presupune folosirea unei variabile auxiliare, iar cealalta folosind doar
  19. operatiile adunare si scadere
  20.  
  21. by DarkByte                                       */

  1. #include"conio.h"
  2. #include"dos.h"
  3. #include"stdio.h"
  4. #include"stdlib.h"
  5. #include"string.h"
  6.  
  7. long int a[200];
  8. int n, metoda, metoda_sort;
  9. char i,b,Mouse=0, Buttons, Draw=0;
  10. unsigned MouseX=0, MouseY=0, MouseB=0;
  11.  
  12. void init             (void);
  13. void info             (void);
  14.  
  15. void meniu            (void);
  16.  
  17. void sortare_bule     (long int sir[], int n);
  18. void sortare_quick    (int i, int s, long int sir[]);
  19. void sortare_numarare (long int sir[], int n);
  20. void sortare_insertie (long int sir[], int n);
  21. void sortare_shell    (long int sir[], int n);
  22. void sortare_intersch (long int sir[], int n);
  23. void sortare_shaker   (long int sir[], int n);
  24.  
  25. void Sortare_sir      (long int sir[], int n, int metoda);
  26. void afisare_sir      (long int sir[], int n);
  27.  
  28. void swap             (long int *a,long int *b, int metoda);
  29.  
  30. void main(void)
  31. {
  32.   textmode(C80);
  33.   init();
  34.   meniu();
  35. }
  36. void InitMouse(char *Inst, char *Buttons)
  37. {
  38.   unsigned I;
  39.   unsigned char B;
  40.   asm {
  41.     mov ax,0;
  42.     int 0x33;
  43.     mov I, ax;
  44.     mov B, bl;
  45.   }
  46.   if (I == 0xFFFF) *Inst = 1;
  47.           else *Inst = 0;
  48.   *Buttons = B;
  49. }
  50. void ShowMouse(void)
  51. {
  52.   asm {
  53.     mov ax,1
  54.     int 0x33;
  55.   }
  56. }
  57. void HideMouse(void)
  58. {
  59.   asm {
  60.     mov ax,2
  61.     int 0x33;
  62.   }
  63. }
  64. void ReadMouse(char Gr)
  65. {
  66.   unsigned int Bb, Xx, Yy;
  67.   asm {
  68.     mov ax, 3;
  69.     int 0x33;
  70.     mov Bb, bx;
  71.     mov Xx, cx;
  72.     mov Yy, dx;
  73.   }
  74.   if (Gr) {
  75.     MouseB = Bb;
  76.     MouseX = Xx;
  77.     MouseY = Yy;
  78.       }
  79.      else {
  80.        MouseB = Bb;
  81.        MouseX = Xx / 8 + 1;
  82.        MouseY = Yy / 8 + 1;
  83.       }
  84. }
  85. void RestrictMouseX(unsigned X1, unsigned X2, char Gr)
  86. {
  87.   if (!Gr) {
  88.     X1 = X1 * 8 - 1;
  89.     X2 = X2 * 8 - 1;
  90.   }
  91.   asm {
  92.     mov ax, 7;
  93.     mov cx, X1;
  94.     mov dx, X2;
  95.     int 0x33;
  96.   }
  97. }
  98. void RestrictMouseY(unsigned Y1, unsigned Y2, char Gr)
  99. {
  100.   if (!Gr) {
  101.     Y1 = Y1 * 8 - 1;
  102.     Y2 = Y2 * 8 - 1;
  103.   }
  104.   asm {
  105.     mov ax, 8;
  106.     mov cx, Y1;
  107.     mov dx, Y2;
  108.     int 0x33;
  109.   }
  110. }
  111. void RestrictMouse(unsigned X1, unsigned Y1, unsigned X2, unsigned Y2, char Gr)
  112. {
  113.   RestrictMouseX(X1,X2,Gr);
  114.   RestrictMouseY(Y1,Y2,Gr);
  115. }
  116. void WriteAt(char X, char Y, char *N, char F, char B, char Col)
  117. {
  118.   register int I,Pos;
  119.   unsigned int far *VideoPtr;
  120.   typedef struct {
  121.     int bit_char : 8;
  122.     int bit1_4   : 4;
  123.     int bit5_7   : 3;
  124.     int bit8     : 1;
  125.   }bit_field;
  126.   union VideoLocation {
  127.     bit_field BF;
  128.     unsigned a;
  129.   }Video;
  130.   VideoPtr = (unsigned int*) MK_FP (0xB800,0);
  131.   Pos = Col*(Y-1)+(X-1);
  132.   if (Draw) HideMouse();
  133.   for (I=Pos;I<strlen(N)+Pos;I++){
  134.     Video.BF.bit_char=N[I-Pos];
  135.     Video.BF.bit1_4=F;
  136.     Video.BF.bit5_7=B;
  137.     Video.BF.bit8=0;
  138.     VideoPtr[I] = Video.a;
  139.                  }
  140.   if (Draw) ShowMouse();
  141. }
  142. void SetMouse(unsigned X, unsigned Y, char Gr)
  143. {
  144.   if (!Gr) {
  145.     X = X * 8 - 1;
  146.     Y = Y * 8 - 1;
  147.   }
  148.   asm {
  149.     mov ax,4;
  150.     mov cx, X;
  151.     mov dx, Y;
  152.     int 0x33;
  153.   }
  154. }
  155. void init(void)
  156. {
  157.   n=5;
  158.   a[0]=5;
  159.   a[1]=1;
  160.   a[2]=9;
  161.   a[3]=3;
  162.   a[4]=7;
  163.   metoda_sort=1;
  164.   metoda=1;
  165. }
  166. void info(char *s)
  167. {
  168.   int i;
  169.   char *met;
  170.   WriteAt(10, 1 ,"Program de sortare a unui sir de maxim 200 de numere intregi", 14, 1, 80);
  171.   WriteAt(3, 3 ,"Setarile ", 15, 0, 80);
  172.   WriteAt(12, 3, s, 15, 0, 80);
  173.   WriteAt(12 + strlen(s) + 1, 3, "ale acestui program sunt :", 15, 0, 80);
  174.   WriteAt(5, 4, "- sirul de numere este ->", 15, 0, 80);
  175.   gotoxy(31, 4);
  176.   textattr(9);
  177.   for (i=0; i<n; i++)
  178.     printf("%d ",a[i]);
  179.   WriteAt(5, 7, "- metoda de sortare este ", 15, 0, 80);
  180.   switch (metoda_sort){
  181.     case 1 : met = "Bubble-Sort."; break;
  182.     case 2 : met = "Quick-Sort."; break;
  183.     case 3 : met = "sortarea prin numarare."; break;
  184.     case 4 : met = "sortarea prin insertie."; break;
  185.     case 5 : met = "Shell-Sort."; break;
  186.     case 6 : met = "sortarea prin interschimbare."; break;
  187.     case 7 : met = "Shaker-sort";
  188.               }
  189.   WriteAt(30, 7, met, 14, 0, 80);
  190.   WriteAt(5, 8, "- metoda de interschimbare este metoda ", 15, 0, 80);
  191.   switch (metoda){
  192.     case 1 : met = "standard."; break;
  193.     case 2 : met = "aritmetica.";
  194.          }
  195.   WriteAt(44, 8, met, 14, 0, 80);
  196. }
  197. void clear(void)
  198. {
  199.   int i, j;
  200.   for (i=17; i<=25; i++)
  201.     for (j=1; j<=80; j++)
  202.       WriteAt(j, i, " ", 15, 0, 80);
  203. }
  204. void citire(long int sir[])
  205. {
  206.   char c, *s;
  207.   int i, j;
  208.   clear();
  209.   n=0;
  210.   do{
  211.     WriteAt(1,18,"Dati numarul de elemente al sirului:",14,0,80);
  212.     gotoxy(39,18);
  213.     _setcursortype(_NORMALCURSOR);
  214.     gets(s);
  215.     sscanf(s,"%d",&n);
  216.     _setcursortype(_NOCURSOR);
  217.     clear();
  218.   } while ((n<1)||(n>200));
  219.  
  220.   for (i=0;i<n;i++){
  221.     WriteAt(1,18,"Dati element: ",14,0,80);
  222.     gotoxy(1,19);
  223.     _setcursortype(_NORMALCURSOR);
  224.     scanf("%d",&sir[i]);
  225.     _setcursortype(_NOCURSOR);
  226.     clear();
  227.     gotoxy(1,21);
  228.     for (j=0;j<=i;j++) printf("%d ",sir[j]);
  229.            }
  230.   clear();
  231. }
  232. int aleg_sort(void)
  233. {
  234.   char c;
  235.   clear();
  236.   WriteAt(1,17,"CE SORTARE DORITI ?",14,0,80);
  237.   WriteAt(1,18,"1. Bubble-Sort",15,0,80);
  238.   WriteAt(1,19,"2. Quick-Sort",15,0,80);
  239.   WriteAt(1,20,"3. Sortare prin numarare",15,0,80);
  240.   WriteAt(1,21,"4. Sortare prin insertie",15,0,80);
  241.   WriteAt(1,22,"5. Shell-Sort",15,0,80);
  242.   WriteAt(1,23,"6. Sortare prin interschimbare",15,0,80);
  243.   WriteAt(1,24,"7. Shaker-Sort",15,0,80);
  244.   gotoxy(1,25);
  245.   _setcursortype(_NORMALCURSOR);
  246.   do{
  247.     c=getch();
  248.   }while ((c<'1')||(c>'7'));
  249.   printf("%c",c);
  250.   _setcursortype(_NOCURSOR);
  251.   clear();
  252.   return c;
  253. }
  254. int aleg_met(void)
  255. {
  256.   char c;
  257.   clear();
  258.   WriteAt(1,17,"Ce metoda de interschimbare doriti?",14,0,80);
  259.   WriteAt(1,18,"1. Standard (cu folosire auxiliar)",15,0,80);
  260.   WriteAt(1,19,"2. Aritmetica (fara folosire auxiliar)",15,0,80);
  261.   gotoxy(1,20);
  262.   _setcursortype(_NORMALCURSOR);
  263.   do{
  264.     c=getch();
  265.   }while ((c<'1')||(c>'2'));
  266.   printf("%c",c);
  267.   _setcursortype(_NOCURSOR);
  268.   clear();
  269.   return c;
  270. }
  271. char *optiune ( int i )
  272. {
  273.   char *o;
  274.   switch (i) {
  275.     case 1:o="           Citire sir             ";break;
  276.     case 2:o=" Alegerea algoritmului de sortare ";break;
  277.     case 3:o="Alegerea metodei de interschimbare";break;
  278.     case 4:o="           SORTEAZA !             ";break;
  279.     case 5:o="          Afiseaza sir            ";break;
  280.     case 6:o="       Iesire din program         ";
  281.   }
  282.   return o;
  283. }
  284. void chenar(int x, int y)
  285. {
  286.   int i;
  287.   for (i=0;i<=33;i++) {
  288.     WriteAt(x+i,y,"Ä",15,0,80);
  289.     WriteAt(x+i,y+7,"Ä",15,0,80);
  290.   }
  291.   for (i=1;i<=6;i++) {
  292.     WriteAt(x-1,y+i,"³",15,0,80);
  293.     WriteAt(x+34,y+i,"³",15,0,80);
  294.   }
  295.   WriteAt(x-1,y,"Ú",15,0,80);
  296.   WriteAt(x+34,y,"¿",15,0,80);
  297.   WriteAt(x-1,y+7,"À",15,0,80);
  298.   WriteAt(x+34,y+7,"Ù",15,0,80);
  299. }
  300. int GetOpt(int y)
  301. {
  302.   return MouseY-y;
  303. }
  304. void Restore_Image(int indent, int top, int o)
  305. {
  306.   textbackground(0);
  307.   HideMouse();
  308.   clrscr();
  309.   _setcursortype(_NOCURSOR);
  310.   for (i=1;i<=6;i++)
  311.     WriteAt(indent,top+i,optiune(i),8,0,80);
  312.   WriteAt(indent,top+o,optiune(o),14,1,80);
  313.   chenar(indent,top);
  314.   info("actuale");
  315.   ShowMouse();
  316. }
  317. void close(void)
  318. {
  319.   RestrictMouse(1, 1, 80, 25, 0);
  320.   exit(0);
  321. }
  322. void meniu(void)
  323. {
  324.   int opt=1,indent=25,top=9;
  325.   char c;
  326.   textbackground(0);
  327.   clrscr();
  328.   _setcursortype(_NOCURSOR);
  329.   WriteAt(indent,top+1,optiune(1),14,1,80);
  330.   for (i=2;i<=6;i++)
  331.     WriteAt(indent,top+i,optiune(i),8,0,80);
  332.   chenar(indent,top);
  333.   info("implicite");
  334.   InitMouse(&Mouse, &Buttons);
  335.   Draw  = 1;
  336.   RestrictMouse(indent, top+1,indent+33, top + 6, 0);
  337.   ShowMouse();
  338.   do {
  339.     ReadMouse(0);
  340.     if (kbhit()!=0) {
  341.       c=getch();
  342.       switch(c){
  343.     case 0:c=getch();
  344.            switch(c){
  345.          case 72:WriteAt(indent,top+opt,optiune(opt),8,0,80);
  346.              opt--;
  347.              if (opt==0) opt=6;
  348.              WriteAt(indent,top+opt,optiune(opt),14,1,80);
  349.              break;
  350.          case 80:WriteAt(indent,top+opt,optiune(opt),8,0,80);
  351.              opt++;
  352.              if (opt==7) opt=1;
  353.              WriteAt(indent,top+opt,optiune(opt),14,1,80);
  354.            };break;
  355.     case 13:switch (opt){
  356.           case 1:citire(a);Restore_Image(indent,top,opt);break;
  357.           case 2:metoda_sort=aleg_sort()-48;Restore_Image(indent,top,opt);break;
  358.           case 3:metoda=aleg_met()-48;Restore_Image(indent,top,opt);break;
  359.           case 4:Sortare_sir(a,n,metoda_sort);
  360.           case 5:afisare_sir(a,n);clear();Restore_Image(indent,top,opt);break;
  361.           case 6:close();
  362.         };
  363.       }
  364.     }
  365.     else {
  366.       if (MouseB==1) {
  367.     i=GetOpt(top);
  368.     if (i!=opt) {
  369.       WriteAt(indent,top+opt,optiune(opt),8,0,80);
  370.       opt=i;
  371.       WriteAt(indent,top+opt,optiune(opt),14,1,80);
  372.       delay(200);
  373.     }
  374.     else switch (opt){
  375.           case 1:citire(a);Restore_Image(indent,top,opt);break;
  376.           case 2:metoda_sort=aleg_sort()-48;Restore_Image(indent,top,opt);break;
  377.           case 3:metoda=aleg_met()-48;Restore_Image(indent,top,opt);break;
  378.           case 4:Sortare_sir(a,n,metoda_sort);
  379.           case 5:afisare_sir(a,n);clear();Restore_Image(indent,top,opt);break;
  380.           case 6:close();
  381.          };
  382.       }
  383.     }
  384.   }while (c!=27);
  385. }
  386. void sortare_bule(long int sir[], int n)
  387. {
  388.   register int i,j;
  389.   char gata;
  390.   do{
  391.     gata=1;
  392.     for (i=0;i<n;i++)
  393.       if (sir[i]>sir[i+1]) {
  394.     swap(&sir[i],&sir[i+1],metoda);
  395.     gata=0;
  396.                }
  397.     n--;
  398.   }while (!gata);
  399. }
  400. void sortare_quick(int i, int s, long int sir[])
  401. {
  402.   long int el;
  403.   register int st,dr;
  404.   st=i;
  405.   dr=s;
  406.   el=sir[(st+dr)/2];
  407.   do{
  408.     while (sir[st]<el) st++;
  409.     while (el<sir[dr]) dr--;
  410.     if (st<=dr) {
  411.       if (sir[st]!=sir[dr]) swap(&sir[st],&sir[dr],metoda);
  412.       st++;
  413.       dr--;
  414.     }
  415.   }while (!(dr<=st));
  416.   if (i < dr) sortare_quick(i,dr,sir);
  417.   if (st < s) sortare_quick(st,s,sir);
  418. }
  419. void sortare_numarare(long int sir[], int n)
  420. {
  421.   long int s1[500];
  422.   register int i,j;
  423.   int c;
  424.   for (i=0;i<=500;i++) s1[i]=0;
  425.   for (i=0;i<=n;i++) {
  426.     c=0;
  427.     for (j=0;j<=n;j++)
  428.       if (sir[j]<sir[i]) c++;
  429.     while (s1[c]) c++;
  430.     s1[c]=sir[i];
  431.              }
  432.   for (i=0;i<=n;i++) sir[i]=s1[i];
  433. }
  434. void sortare_insertie(long int sir[], int n)
  435. {
  436.   long int s1[500];
  437.   register int i,j;
  438.   int k,aux;
  439.   char gata;
  440.   for (i=1;i<=n;i++){
  441.     aux=sir[i];
  442.     k=-1;
  443.     j=i-1;
  444.     gata=0;
  445.     while ((j>=0)&&(!gata)){
  446.       if (sir[j]>aux){
  447.     sir[j+1]=sir[j];
  448.     j--;
  449.       }
  450.          else{
  451.     k=j;
  452.     gata=1;
  453.       };
  454.     }
  455.     sir[k+1]=aux;
  456.   }
  457. }
  458. void sortare_shell(long int sir[], int n)
  459. {
  460.   int i,h;
  461.   char gata;
  462.   h=n;
  463.   while (h>1) {
  464.     h=h / 2;
  465.     do {
  466.       gata=1;
  467.       for (i=0;i<=n-h;i++) {
  468.     if (sir[i]>sir[i+h]) {
  469.       swap(&sir[i],&sir[i+h],metoda);
  470.       gata=0;
  471.     }
  472.       };
  473.     }while (!gata);
  474.   }
  475. }
  476. void sortare_interschimbare(long int sir[], int n)
  477. {
  478.   register int i,j;
  479.   for (i=0;i<=n;i++)
  480.     for (j=i+1;j<=n;j++)
  481.       if (sir[i]>sir[j]) {
  482.     swap(&sir[i],&sir[j],metoda);
  483.                }
  484. }
  485. void sortare_shaker(long int sir[], int n)
  486. {
  487.   register int j;
  488.   int k,s,d;
  489.   s=1;
  490.   k=n;
  491.   d=n;
  492.   do {
  493.     for (j=d;j>=s;j--)
  494.       if (sir[j-1]>sir[j]) {
  495.     swap(&sir[j-1],&sir[j],metoda);
  496.     k=j;
  497.                }
  498.      s=k+1;
  499.      for (j=s;j<=d;j++)
  500.        if (sir[j-1]>sir[j]) {
  501.      swap(&sir[j-1],&sir[j],metoda);
  502.      k=j;
  503.                 }
  504.      d=k-1;
  505.   } while (s<=d);
  506. }
  507. void afisare_sir(long int sir[], int n)
  508. {
  509.   int i,b,x,y;
  510.   clear();
  511.   gotoxy(1,18);
  512.   if (n)
  513.     for (i=0;i<n;i++)
  514.       printf("%d ",sir[i]);
  515.     else printf("Nu a fost introdus sirul !");
  516.   WriteAt(60,25,"Apasati orice tasta !",15,0,80);
  517.   getch();
  518. }
  519. void Sortare_sir(long int sir[], int n, int metoda)
  520. {
  521.   switch (metoda) {
  522.     case 1:sortare_bule(sir,n-1);
  523.        break;
  524.     case 2:sortare_quick(0,n-1,sir);
  525.        break;
  526.     case 3:sortare_numarare(sir,n-1);
  527.        break;
  528.     case 4:sortare_insertie(sir,n-1);
  529.        break;
  530.     case 5:sortare_shell(sir,n-1);
  531.        break;
  532.     case 6:sortare_interschimbare(sir,n-1);
  533.        break;
  534.     case 7:sortare_shaker(sir,n-1);
  535.   }
  536. }
  537. void swap(long int *v1, long int *v2, int metoda)
  538. {
  539.   long int aux;
  540.   switch (metoda){
  541.     case 1: aux=*v1;
  542.         *v1=*v2;
  543.         *v2=aux;
  544.         break;
  545.     case 2: *v1=*v1+*v2;
  546.         *v2=*v1-*v2;
  547.         *v1=*v1-*v2;
  548.   }
  549. }
  550. /*
  551.     MUST STILL BE DONE !!!
  552. *alegere tip de sortare - ascendenta, descendenta
  553.  
  554. */
0,0p / 0 votes
User avatar
DarkByte
11011011
 
Joined: 29 Dec 2009
Status: 136

Re: Algoritmi de sortare - Borland C++ 3.1

Postby noobakaflo » 23 Mar 2011, 21:09

Am copiat sursa in Borland C++ 4.5 curios sa vad ce face, dar cum era de asteptat ,vreo 10 erori..
Ce modificari as putea aduce codului sa 'mearga' in 4.5 ? Sau nu 'merge' ? :D Care ar fi diferenta de sintaxa ca sa zic asa dintre 4.5 si 3.1 ?
0,0p / 0 votes
User avatar
noobakaflo
Bit
 
Joined: 10 Dec 2010
Location: Ploiesti
Status: 1

Re: Algoritmi de sortare - Borland C++ 3.1

Postby DarkByte » 23 Mar 2011, 21:28

N-am nici cea mai mica idee. Asta a fost cam ultimul program pe care l-am scris in C ...

Curiozitate: BC++ 4.5 iti permite sa faci programe DOS ? Console sau ceva in gen ? Daca nu permite asta, atunci codul nu i se potriveste in forma actuala: programul foloseste acces direct in memoria video (text), some assembler pentru mouse (which may not be required at all) ... si ca sa puna capac, functia main e de tip void :))
0,0p / 0 votes
User avatar
DarkByte
11011011
 
Joined: 29 Dec 2009
Status: 136

Re: Algoritmi de sortare - Borland C++ 3.1

Postby noobakaflo » 24 Mar 2011, 07:13

Da,pot face programe Dos, cu consola..
0,0p / 0 votes
User avatar
noobakaflo
Bit
 
Joined: 10 Dec 2010
Location: Ploiesti
Status: 1

Re: Algoritmi de sortare - Borland C++ 3.1

Postby DarkByte » 24 Mar 2011, 14:06

Console application nu inseamna, in mod necesar, aplicatie DOS.

However, ar fi interesant sa postezi aici erorile pe care le primesti, poate-l dibuim :)
0,0p / 0 votes
User avatar
DarkByte
11011011
 
Joined: 29 Dec 2009
Status: 136

Re: Algoritmi de sortare - Borland C++ 3.1

Postby andreiandreiq » 24 Mar 2011, 18:42

Am incercat si eu :d (credeam ca eu nu primesc erori :)) ). Si daca tot am incercat uite si erorile (cred ca sunt aceleasi pe care le-a primit si noobakaflo):

  1. Compiling NONAME00.CPP:
  2. Error NONAME00.CPP 32: Call to undefined function 'textmode' in function main()
  3. Error NONAME00.CPP 176: Call to undefined function 'textattr' in function info(char *)
  4. Error NONAME00.CPP 213: Call to undefined function '_setcursortype' in function citire(long *)
  5. Error NONAME00.CPP 245: Call to undefined function '_setcursortype' in function aleg_sort()
  6. Error NONAME00.CPP 262: Call to undefined function '_setcursortype' in function aleg_met()
  7. Error NONAME00.CPP 306: Call to undefined function 'textbackground' in function Restore_Image(int,int,int)
  8. Error NONAME00.CPP 309: Call to undefined function '_setcursortype' in function Restore_Image(int,int,int)
  9. Error NONAME00.CPP 326: Call to undefined function 'textbackground' in function meniu()
  10. Error NONAME00.CPP 328: Call to undefined function '_setcursortype' in function meniu()
  11. Error NONAME00.CPP 372: Call to undefined function 'delay' in function meniu()


Si cateava warning-uri:

  1. Warning NONAME00.CPP 399: 'j' is declared but never used in function sortare_bule(long *,int)
  2. Warning NONAME00.CPP 441: Conversion may lose significant digits in function sortare_insertie(long *,int)
  3. Warning NONAME00.CPP 457: 's1' is declared but never used in function sortare_insertie(long *,int)
  4. Warning NONAME00.CPP 518: 'y' is declared but never used in function afisare_sir(long *,int)
  5. Warning NONAME00.CPP 518: 'x' is declared but never used in function afisare_sir(long *,int)
  6. Warning NONAME00.CPP 518: 'b' is declared but never used in function afisare_sir(long *,int)
  7.  
0,0p / 0 votes
Image
User avatar
andreiandreiq
Word
 
Joined: 30 Dec 2009
Status: 33.33

Re: Algoritmi de sortare - Borland C++ 3.1

Postby noobakaflo » 24 Mar 2011, 20:40

  1.  
  2. Error NONAME04.CPP 32: Call to undefined function 'textmode' in function main()
  3. Error NONAME04.CPP 176: Call to undefined function 'textattr' in function info(char *)
  4. Error NONAME04.CPP 213: Call to undefined function '_setcursortype' in function citire(long *)
  5. Warning NONAME04.CPP 214: Possible use of 's' before definition in function citire(long *)
  6. Warning NONAME04.CPP 231: 'c' is declared but never used in function citire(long *)
  7. Error NONAME04.CPP 245: Call to undefined function '_setcursortype' in function aleg_sort()
  8. Error NONAME04.CPP 262: Call to undefined function '_setcursortype' in function aleg_met()
  9. Error NONAME04.CPP 306: Call to undefined function 'textbackground' in function Restore_Image(int,int,int)
  10. Error NONAME04.CPP 309: Call to undefined function '_setcursortype' in function Restore_Image(int,int,int)
  11. Error NONAME04.CPP 326: Call to undefined function 'textbackground' in function meniu()
  12. Error NONAME04.CPP 328: Call to undefined function '_setcursortype' in function meniu()
  13. Error NONAME04.CPP 372: Call to undefined function 'delay' in function meniu()
  14. Warning NONAME04.CPP 399: 'j' is declared but never used in function sortare_bule(long *,int)
  15. Warning NONAME04.CPP 441: Conversion may lose significant digits in function sortare_insertie(long *,int)
  16. Warning NONAME04.CPP 457: 's1' is declared but never used in function sortare_insertie(long *,int)
  17. Warning NONAME04.CPP 518: 'y' is declared but never used in function afisare_sir(long *,int)
  18. Warning NONAME04.CPP 518: 'x' is declared but never used in function afisare_sir(long *,int)
  19. Warning NONAME04.CPP 518: 'b' is declared but never used in function afisare_sir(long *,int)
  20.  


Cam astea ar fi erorile mele ... Cred ca mai bine mi-as stapani curiozitatea pana invat si eu sa fac cu afisari direct in memoria video .. :D
0,0p / 0 votes
User avatar
noobakaflo
Bit
 
Joined: 10 Dec 2010
Location: Ploiesti
Status: 1

Re: Algoritmi de sortare - Borland C++ 3.1

Postby v0id » 24 Mar 2011, 20:45

Offtopic
0,0p / 0 votes
A good coder is never on holiday - he may be working on a different machine, that's about as far as it gets.
User avatar
v0id
Word
 
Joined: 05 Jan 2010
Location: 127.0.0.1
Status: 39.5

Re: Algoritmi de sortare - Borland C++ 3.1

Postby smith » 24 Mar 2011, 21:04

Offtopic
0,0p / 0 votes
Ilea Cristian
User avatar
smith
Enum
 
Joined: 29 Dec 2009
Location: Cluj-Napoca
Status: 82

Re: Algoritmi de sortare - Borland C++ 3.1

Postby v0id » 24 Mar 2011, 21:25

Offtopic
0,0p / 0 votes
A good coder is never on holiday - he may be working on a different machine, that's about as far as it gets.
User avatar
v0id
Word
 
Joined: 05 Jan 2010
Location: 127.0.0.1
Status: 39.5

Re: Algoritmi de sortare - Borland C++ 3.1

Postby DarkByte » 24 Mar 2011, 21:54

Offtopic
0,0p / 0 votes
User avatar
DarkByte
11011011
 
Joined: 29 Dec 2009
Status: 136


Return to Algoritmică

Who is online

Users browsing this forum: No registered users and 0 guests