Greetings,
If you input these values 99 33 44 88 22 11 55 66 77 -1 what should you get?
From what I read about push_back is that it should push back the very last number right? Thats not what I get though, can someone please explain why? Am i missing something in my code??
Code:
#include <iostream> //cin, cout, <<, >.
#include <vector> //for vector
using namespace std;
#define nl '/n'
vector<int> number,
v(10, 20),
w(10);
int num;
int main()
{
for (;;) //loops forever
{
cin >> num; //input number
if (num < 0) break; //if number is less than 0 break
number.push_back(num); //push_back a number
cout << num << nl; //output the number with the push_back
}
return 0;
}
:(