当我尝试调试此代码以从文件中读取并显示它时,控制台屏幕来来往往很快,我不明白它为什么这样做。任何人都可以帮助我吗?
#include "Questions.h"
#include <iostream>
using namespace std;
const int MAXITEMS = 10;
struct quiz
{
string question;
string anser;
};
int main ()
{
string str;
ifstream ifs("Questions2.txt.txt");
getline (ifs,str);
cout << "first line of the file is " << str << ".\n";
return 1;
}