Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <vector>
- #include <iostream>
- /*Napisati program koji će primiti vector brojeva,
- i ispisati korisniku koji brojevi su parni, a koji neparni*/
- using namespace std;
- vector <int> numb;
- void vectInputAndCheck(vector <int> n1) {
- //input
- for (int i = 0; i < 5; i++) {
- int num;
- cin >> num;
- n1.push_back(num);
- }
- //check
- cout << "Parni\n ";
- for (size_t i = 0; i <n1.size(); i++) {
- if (n1[i] % 2 == 0) {
- cout << n1[i]<<endl;
- }
- }
- //check neparni
- cout << "Neparni\n";
- for (int i = 0; i < n1.size(); i++) {
- if (n1[i] % 2 == 1) {
- cout << n1[i]<<endl;
- }
- }
- };
- int main() {
- cout << "Input nums\n";
- vectInputAndCheck(numb);
- system("Pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement