Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include<vector>
- using namespace std;
- int main ()
- {
- int protokol;
- cout<<"Podaj dane wejsciowe:"<<endl;
- vector<int> numerIp;
- cin >> protokol;
- int tymczasowa;
- if((protokol<=10)&&(protokol>=3))
- {
- while(protokol)
- {
- cin >> tymczasowa;
- numerIp.push_back(tymczasowa);
- protokol--;
- };
- tymczasowa=0;
- sort(numerIp.begin(), numerIp.end());
- vector<int>::iterator index;
- {
- for (index=numerIp.begin(); index<numerIp.end()-1; index++)
- {
- cout << *index << ".";
- };
- cout <<*index<<endl;
- }
- int n=0;
- while ((next_permutation(numerIp.begin(),numerIp.end()))&&(tymczasowa<256))
- {
- {
- for (index=numerIp.begin(); index<numerIp.end()-1; index++)
- {
- cout << *index << ".";
- };
- cout <<*index<<endl;
- }
- tymczasowa++;
- };
- }else
- {
- cout<<"Zły numer protokołu uruchom program ponownie!";
- exit(1);
- }
- system("pause");
- return 0;
- };
Add Comment
Please, Sign In to add comment