Guest User

Untitled

a guest
Jul 16th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include<vector>
  4.  
  5. using namespace std;
  6.  
  7. int main ()
  8. {
  9. int protokol;
  10. cout<<"Podaj dane wejsciowe:"<<endl;
  11. vector<int> numerIp;
  12. cin >> protokol;
  13. int tymczasowa;
  14.  
  15. if((protokol<=10)&&(protokol>=3))
  16. {
  17. while(protokol)
  18. {
  19. cin >> tymczasowa;
  20. numerIp.push_back(tymczasowa);
  21. protokol--;
  22. };
  23. tymczasowa=0;
  24. sort(numerIp.begin(), numerIp.end());
  25.  
  26. vector<int>::iterator index;
  27. {
  28. for (index=numerIp.begin(); index<numerIp.end()-1; index++)
  29. {
  30. cout << *index << ".";
  31. };
  32. cout <<*index<<endl;
  33. }
  34. int n=0;
  35. while ((next_permutation(numerIp.begin(),numerIp.end()))&&(tymczasowa<256))
  36. {
  37. {
  38. for (index=numerIp.begin(); index<numerIp.end()-1; index++)
  39. {
  40. cout << *index << ".";
  41. };
  42. cout <<*index<<endl;
  43. }
  44. tymczasowa++;
  45. };
  46. }else
  47. {
  48. cout<<"Zły numer protokołu uruchom program ponownie!";
  49. exit(1);
  50. }
  51. system("pause");
  52. return 0;
  53. };
Add Comment
Please, Sign In to add comment