텍스트 파일을 읽고 배열에 저장하려하지만 프로그램이 계속 무한 루프에 걸려 있습니다.데이터 파일을 배열로 읽어들입니다.
이int main() {
const int size = 10000; //s = array size
int ID[size];
int count = 0; //loop counter
ifstream employees;
employees.open("Employees.txt");
while(count < size && employees >> ID[count]) {
count++;
}
employees.close(); //close the file
for(count = 0; count < size; count++) { // to display the array
cout << ID[count] << " ";
}
cout << endl;
}
디버거에서 실행 해 보셨습니까? – anishsane
정확한 코드인가요? 방금 해봤는데 효과가있었습니다. – BoBTFish
무한 루프? 귀하의 코드는 각 루프에 대해 최대 10000 번 반복을 생성합니다. – Geoffroy