yes i think i get that, but the problem for me is that there is an unknown # of words to be placed in the vector
so i am having trouble using a loop to figure out when to stop
Code:
#include <iostream.h>
#include <stdlib.h>
#include "sstream.h"
#include <string>
#include <vector>
using namespace std;
int main()
{
string word0, word1, word2, word3, word4, temp;
vector <string> v;
string s(" buy 1000 bushels corn 300 ");
cout << s << endl;
istringstream iss(s); //this works cause i know # words
iss >> word0;
iss >> word1;
iss >> word2;
iss >> word3;
iss >> word4;
cout << word0 << " " << word1<< " " << word2 << " " << word3 << " "
<< word4 << endl;
//HOW DO I MAKE THIS WORK??
string t(" buy 1000 bushels corn 300 ");
istringstream jss(t);
while( **WHAT GOES HERE TO CONTROL LOOP ???? ****)
{
jss >> temp;
v.push_back(temp);
}
cout << v[0];
system("PAUSE");
return 0;
}
sorry for caps, just wanted to be clear
thanks for your response