i would like to stack first line with second line,put |between them.
third line forth line fith line stack together.and use <BR>to joint them,depend on how many definitions a word with until get a line with </>
when read first line out<<s; ( this is output of file)
read second line out<< "|" << s <<endl;
read third line downward out<< s << "<BR>"; until reach a line with </> when getl a ine with </> out<<"\t\n"<<s;
then run again after line with </> and state second word(vocabulary2) as first line and do it again, and so on. this is dictionary txt file type
word1|word1 other form(first line)
definition1<BR>definition2<BR>......(put them into one line)
</> (i will use ultraedit to remove it after i get my correct output, there should be blank line between two words)
word2|word2 other form (sample: CPU|central processing unit
1. central processing unit.<BR>2. Occasionally used (although less and less) to refer to the system unit. (all meaning into one line, and </>with a line to seperate words and meaning)
there's around over 200 thousands of words, so i need to write a program to array them
hehe, i don't know if i make is specify yet. thanks again reply me.
here's my new source(suggest one word only(1), one word other form(2),with 4 lines definitions, i array them like that)
#include<iostream> #include<string> #include <fstream> #include <cstring> using namespace std; int main() { string s; ifstream in("1.txt"); ofstream out("2.txt"); int i=0; while(getline(in,s)) { if(i==0||i==2) out<<s; else if(i==1) out<<"|"<<s<<endl; else out<<"<BR>"<<s; i++; } }
i don't know how to let the program to repeat doing other words, there are so many words and lines in the txt , i still don't know to tell the program to array them.
|