Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. // Example program
  2. #include <iostream>
  3. #include <string>
  4. #include <time.h>
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7.  
  8.  
  9. using namespace std;
  10. int v[91];
  11. int nr1[5];
  12. void afisNumere()
  13. {
  14. system("clear");
  15. int k=0;
  16. for(int i=1;i<=90;i++)
  17. {
  18. if(v[i]>0)
  19. {
  20. if(i<10)
  21. cout<<" ";
  22. cout<<i<<" , ";
  23. k++;
  24. }
  25. if((i+1)%10==0 )
  26. cout<<endl;
  27. }
  28. cout<<endl;
  29. }
  30. int main()
  31. {
  32. srand (time(NULL));
  33.  
  34. while(1)
  35. {
  36.  
  37. int nr = rand() % 90+1;
  38. if(v[nr]==0)
  39. {
  40.  
  41. cout<<"\n\nNr extras este: "<<nr<<endl;
  42. printf("\t\t\t\t\t\t\t%d %d %d %d %d\t\t\t\t\t%d",nr1[0],nr1[1],nr1[2],nr1[3],nr1[4],nr);
  43. nr1[4]=nr1[3];
  44. nr1[3]=nr1[2];
  45. nr1[2]=nr1[1];
  46. nr1[1]=nr1[0];
  47. nr1[0]=nr;
  48. cout.flush();
  49. }
  50. v[nr]++;
  51. if(v[nr]==1)
  52. {
  53. if (cin.get() == '\n')
  54. {
  55. afisNumere();
  56. }
  57. }
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement