Help with Programming

Pages: 12
It was worth the upgrade to VS 2019. :O)
What exactly does the text file you are trying to read contain? 88, 90? If there is a comma in the text file, that could complicate things a bit. If there is no comma then try playing with this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <fstream>
#include <vector>

using namespace std;

int main() {
	
	int i;
	vector<int> v;
	fstream file;
	file.open("grades.txt");

	while (file >> i) {
		v.push_back(i);
	}

	cout << v[0];
	return 0;
}
Last edited on
Topic archived. No new replies allowed.
Pages: 12