Hello. I have to read an unknown amount of integers, which are separated by commas (which is my problem here) into a vector. If there are no commas, I can do that. But I don't know how to do it with commas. I'm not allowed to use a lot of stuff, such as functions or classes yet. I can only use very simple code.
Here is how I am trying to read data into the vector. Nothing happens, however. Can anyone give me some pointers?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
ifstream input;
input.open("D:\\newdata.txt");
if (input >> data){
ch = input.peek(); //peek at the first character
if (!isdigit(ch)){
cout << ch;
}
else{
input >> data;
salaryData.push_back(data);
}
}