#include<iostream>
#include<fstream>
#include<string>
#include <vector>
using namespace std;
int main(int argv, char *arg[])
{
fstream f("file.txt");
vector<string> words;
string line;
while (getline(f, line))
{
words.push_back(line);
}
//dictionary.txt在csdn里面可以下载,里面有4万多个单词,相当于一个字典
cout << "共有单词数目:" << words.size() << endl;
for (int i = 0; i < words.size(); i++)
{
cout << words[i] << endl;
}
return 0;
}
#include<fstream>
#include<string>
#include <vector>
using namespace std;
int main(int argv, char *arg[])
{
fstream f("file.txt");
vector<string> words;
string line;
while (getline(f, line))
{
words.push_back(line);
}
//dictionary.txt在csdn里面可以下载,里面有4万多个单词,相当于一个字典
cout << "共有单词数目:" << words.size() << endl;
for (int i = 0; i < words.size(); i++)
{
cout << words[i] << endl;
}
return 0;
}