SHOW:
         |
         |
         - or go back to the newest paste.    
    | 1 | #include <iostream>  | |
| 2 | #include <vector>  | |
| 3 | ||
| 4 | typedef std::vector <int> vektor;  | |
| 5 | ||
| 6 | bool funkcija (int n)  | |
| 7 | {
 | |
| 8 | ||
| 9 | for (int i (2); i<n; i++)  | |
| 10 | if (n%i==0)  | |
| 11 | return false;  | |
| 12 | ||
| 13 | return true;  | |
| 14 | ||
| 15 | ||
| 16 | }  | |
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | int main()  | |
| 21 | ||
| 22 | {
 | |
| 23 | ||
| 24 | std::cout<<"Unesite broj elemenata vektora:\n";  | |
| 25 | int n;  | |
| 26 | std::cin>>n;  | |
| 27 | ||
| 28 | std::cout<<"Unesi vektor: \n";  | |
| 29 | vektor v(n);  | |
| 30 | std::vector<int> b,c;  | |
| 31 | ||
| 32 | for (int i(0); i < n; i++)  | |
| 33 |     {
 | |
| 34 | ||
| 35 | std::cin >> v.at(i);  | |
| 36 | ||
| 37 | }  | |
| 38 | ||
| 39 | for (int x: v)  | |
| 40 |     {
 | |
| 41 | - | if (x==1) continue;  | 
| 41 | + | if (x==1) continue;  | 
| 42 | if (funkcija(x)) b.push_back(x);  | |
| 43 | else c.push_back(x);  | |
| 44 | ||
| 45 | }  | |
| 46 | ||
| 47 | for (int i(0); i<b.size(); i++)  | |
| 48 | ||
| 49 |     {
 | |
| 50 | ||
| 51 | std::cout << b[i] << " ";  | |
| 52 | if (i!=(b.size()-1)) std::cout<<", " ;  | |
| 53 | }  | |
| 54 | std::cout << std::endl;  | |
| 55 | for (int i(0); i<c.size(); i++)  | |
| 56 |     {
 | |
| 57 | std::cout<< c[i]<< " ";  | |
| 58 | if (i!= (c.size()-1)) std::cout<<", ";  | |
| 59 | }  | |
| 60 | ||
| 61 | ||
| 62 | return 0;  | |
| 63 | ||
| 64 | }  |