Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int tab[5] = { 1, 2, 3, 4, 5 };
  5. int tab2[5];
  6. int tab3[5] = { 1, 2, 3, 4, 5 };
  7. int licznik = 0;
  8. void sort(int n)
  9. {
  10. int flaga = 1;
  11. while (flaga)
  12. {
  13. flaga = 0;
  14. for (int i = 0; i < n; i++)
  15. {
  16. if (tab[i] > tab[i + 1])
  17. {
  18. int zapas = tab[i];
  19. tab[i] = tab[i + 1];
  20. tab[i + 1] = zapas;
  21. flaga = 1;
  22. }
  23. }
  24. }
  25. }
  26. void wypisz(int m)
  27. {
  28. cout << endl;
  29. for (int i = 0; i < m; i++)
  30. {
  31. cout << tab2[i];
  32. }
  33. }
  34. int znajdzPlusJeden(int a, int n)
  35. {
  36. int pomoc = NULL;
  37. for (int i = 0; i < n - 1; i++)
  38. {
  39. if (tab[i] == a) {
  40. pomoc = tab[i + 1];
  41. i = n;
  42. }
  43. }
  44. return pomoc;
  45. }
  46. void kombinacja(int n, int m)
  47. {
  48. for (int i = 0; i < m; i++)
  49. {
  50. tab2[i] = tab[i];
  51. }
  52. wypisz(m);
  53. int flaga = 1;
  54. int poziom = m-1;
  55. while (flaga)
  56. {
  57. if (znajdzPlusJeden(tab2[poziom] == NULL)) poziom--;
  58. if (tab[m-1] == tab[])
  59. }
  60.  
  61. }
  62.  
  63.  
  64. int main()
  65. {
  66. int n, m, poziom;
  67. cout << "Podaj proszę ilosc elementow";
  68. //cin >> n;
  69. cout << "Podaj proszę ilosc elementow podzbioru";
  70. //cin >> m;
  71. poziom = 0;
  72. n = 5;
  73. m = 3;
  74. //sort(n);
  75. kombinacja(n, m,);
  76. cin >> m;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement