Guest User

Untitled

a guest
Nov 12th, 2019
109
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <graphics.h>
  3. #include <stdlib.h>
  4. #include <conio.h>
  5. #include <math.h>
  6. #include <dos.h>
  7.  
  8. using namespace std;
  9.  
  10. const int n=10;
  11. int v[n]={3, 18, 22, 25, 48, 64, 72, 77, 82, 99};
  12. char* v1[n];
  13.  
  14. int cautareBinara(int stg, int dr, int nr)
  15. {
  16. if(stg>dr)
  17. return -1;
  18. else
  19. {
  20. int mij=(stg+dr)/2;
  21. if(v[mij]==nr)
  22. return mij;
  23. if(nr<mij)
  24. return cautareBinara(stg,mij-1,nr);
  25. else
  26. return cautareBinara(mij+1,dr,nr);
  27. }
  28. }
  29.  
  30. void cercuri(int x, int y)
  31. {
  32. // x=40;
  33. // y=250;
  34. for(int i=1; i<=n; i++)
  35. {
  36. setcolor(WHITE);
  37. circle(x,y,40);
  38. itoa(v[i],v1[i],10);
  39. outtextxy(x-20,y,v1[i]);
  40. x+=100;
  41. }
  42. getch();
  43. closegraph();
  44.  
  45. }
  46.  
  47. int main()
  48. {
  49. initwindow(800,600);
  50. int nr;
  51. cout<<"Introduceti numarul pe care il cautati in sir: ";
  52. cin>>nr;
  53. cercuri(40,250);
  54. //setcolor(WHITE);
  55. //circle(100,60,40);
  56. getch();
  57. closegraph();
  58.  
  59. return 0;
  60. }
RAW Paste Data