C++ read integers from file and save into array
问题 I'm making a program that reads only integers from text file. I want to make a function that reads integers and stores them in an array so I can use that array later to sort them with bubble sort. This is what I have so far but the output I get is some random -803234.... number : void read(int A[max], int& numbers) { ifstream file("ints.txt"); if (file.is_open()) { file >> numbers; for (int i = 0; i < numbers; i++) { cout << "numbers: " << A[i] << endl; } file.close(); } cout << "numbers in