Do you read pairs of values and you don't know how many pairs the user would want to insert?
I would use two doubles and a container.
First initialize the two variables, then read the first pair using
Code:
cin>>elem1;
cin>>elem2;
After each pair reading, insert the values just read to a vector of double, or better yet a vector <pair<double> >;
If the pair type seems scary, you can replace it with a simple struct:
Code:
struct MyPair
{
double d1, d2;
} mp;
while (...//until the user presses some key)
{
cin>>mp.d1;
cin>>mp.d2;
vector<MyPair> myvec;
myvec.pushback(mp);
}
If you're not familiar with vectors, you should be!
Here's a short tutorial: http://www.devx.com/DevX/LegacyLink/9396
Bookmarks