30/09/2018, 21:13
Lỗi khi chạy chương trình trong C++
# include <iostream>
# include <string>
# include <fstream>
# include <string.h>
using namespace std;
struct linh{
string A, B;
};
int main(){
linh abc[20];
ifstream xuat;
xuat.open("ghi.txt", ios::in);
int i = 0;
while (!xuat.eof()){
if (i%2==0)
getline(xuat, abc[i].A);
if (i%2==1)
getline(xuat, abc[i].B);
i++;
}
xuat.close();
cout << abc[3].B << endl;
system("pause>nul");
}
sao chương trình của em lúc built thì nó báo thành công mà lúc chạy thì lại bị đơ ạ? Và phải khắc phục như thế nào ạ
Bài liên quan