having a vector read multiple data file

Im suppose to create a program to read a data file using vectors now what i started so far it only reads in the first number and thats all any idea on what i went wrong?

the newdata file contains 10 20 30 40 50

#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<iomanip>
#include<vector>

using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
vector<int> Salery;
int x;
char choice;
ifstream dataFile;

dataFile.open("newdata.txt");

while (dataFile >> x)

Salery.push_back(x);

if (Salery.size () ==0)
cout << "no elements \n";
else
{
for (int i = 0; i<Salery.size(); i++)
{ cout <<Salery.at(i);
cout << "\n";

}}
Topic archived. No new replies allowed.