Use a vector container.
Code:
#include <iostream>
#include <vector>
int main() {
std::vector<int> myVariables;
int currVar;
std::cout << "Enter numbers seperated by spaces. Press ENTER to stop." << std::endl;
do {
std::cin >> currVar; // Not bothering with validity checking
myVariables.push_back(currVar);
} while(std::cin.peek() != '\n');
std::cin.ignore();
std::cout << "You entered the numbers: ";
for(std::vector<int>::iterator i = myVariables.begin(); i < myVariables.end(); i++)
std::cout << *i << ' ';
std::cin.get();
return 0;
}
EDIT: Note to self, take a little less time on an example, next time.