-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathword.cpp
More file actions
49 lines (47 loc) · 710 Bytes
/
word.cpp
File metadata and controls
49 lines (47 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<sstream>
#include<string.h>
using namespace std;
int main()
{
vector<string> list;
ofstream word("words.txt");
ifstream data("datanew.txt");
char line[50000];
int i=0;
while(data)
{
data.getline(line,50000,'\n');
cout<<(++i)<<endl;
istringstream iss(line);
string label;
iss>>label;
string s;
while(iss)
{
iss>>s;
//cout<<s<<endl;
bool flag=false;
for(int i=0;i<list.size();i++)
{
if(s==list[i])
{
flag=true;
break;
}
}
if(!flag)
{
list.push_back(s);
}
}
}
for(int i=0;i<list.size();i++)
{
//cout<<list[i]<<endl;
word<<list[i]<<endl;
}
}