Text file into Vector
If I have the following code, how do I display what's in myVector?
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
void calculations(ifstream& infile, vector<double>& myVector)
{
double value = 0;
int counter = 0;
string line;
stringstream input(line);
while(input >> value)
{
myVector.push_back(value);
++counter;
}
cout << myVector.at(value) << endl;
}
|
If you're looking to print everything, just use a for loop and cout to print all the data...
|
for (int index = 0; index < myVector.size(); index++) {cout<<myVector[index];}
|
Topic archived. No new replies allowed.