十六章第三题

自己定义一个txt文件

 const string filename = "diyi.txt";
 std::vector<string> wordlist;
 ifstream fin;
 fin.open(filename.c_str());
 if (!fin.is_open())
 {
    
    
  cout << "can't open\n";
  exit(EXIT_FAILURE);
 }
 string temp;
 while (fin >> temp)
  wordlist.push_back(temp);
 const int NUM = wordlist.size();
 srand(time(0));
 char play; //后接16.3.cpp

猜你喜欢

转载自blog.csdn.net/wode_0828/article/details/108836901