I have a weird problem, so my instructor told us to create a simple program using vectors that will first ask the user how many integers they want to enter, and after the numbers were entered via a space as a delimiter the output should add 2 to each vector element.
Ex -
How many numbers are you going to enter = 4 (Lets assume the user enters 4)
     Enter the numbers = 11 45 71 24 (Lets assume the user entered these 4 numbers)
THE OUTPUT SHOULD BE THIS = 13 47 73 26 (with spaces added 2)
Since using vectors is a must, i know how to add add 2 with a normal integer vector output but when it comes with spaces i have no idea, so far the program i wrote will accept everything before the space into the vector and will add 2 to it.
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    vector <int> userInput;
    int input;
    int number;
    int num1;
    cout << "How many numbers are you going to enter ? :";
    cin >> number;
    cout << "Enter the Numbers : " << endl;
    cin >> input;
    userInput.push_back(input);
    cout << "Vector Contains : ";
    for (unsigned int i = 0; i < userInput.size(); i++)
    {
        cout << userInput[i] + 2;
    }   
    system("pause>nul");
    return 0;
}
 
     
     
     
    