473,395 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

anagram problem

Hello,
many thanks for all good tipps up to now.
It's read a textfile in this structure:
opst post
opst stop
aagin again
enw new
and so on.

int main(){
ifstream in("test.txt");
char zeile[256];char zeile1[256];char zeile2[256];
char tmp[256] = "";char tmp1[256]= "";char tmp2[256]= "";
char tmp3[256]= "";
in.seekg(0);
while ( in.getline(zeile1,255,'\t')){
strcpy(tmp1,zeile1);
in.getline(zeile1,255,'\n');
strcpy(tmp3,zeile3);
double merke=in.tellg();
in.seekg(0);
while ( in.getline(zeile,255,'\t')){
strcpy(tmp,zeile);
//read letter order
in.getline(zeile2,255,'\n');
strcpy(tmp2,zeile);
if ((tmp==tmp1)&&(strcmp(tmp2,tmp5)!=0)){
cout << zeile2 << endl;
}
}
in.clear();
in.seekg(merke);
}
return 0;
}
How can I prevent that double existing words will be shown.
Many thanks for reply
Jul 22 '05 #1
1 3712
On 12 May 2004 07:38:24 -0700, ja*******@hotmail.com (BjoernJackschina)
wrote:
Hello,
many thanks for all good tipps up to now.
It's read a textfile in this structure:
opst post
opst stop
aagin again
enw new
and so on.

int main(){
ifstream in("test.txt");
char zeile[256];char zeile1[256];char zeile2[256];
char tmp[256] = "";char tmp1[256]= "";char tmp2[256]= "";
char tmp3[256]= "";
in.seekg(0);
while ( in.getline(zeile1,255,'\t')){
strcpy(tmp1,zeile1);
in.getline(zeile1,255,'\n');
strcpy(tmp3,zeile3);
double merke=in.tellg();
in.seekg(0);
while ( in.getline(zeile,255,'\t')){
strcpy(tmp,zeile);
//read letter order
in.getline(zeile2,255,'\n');
strcpy(tmp2,zeile);
if ((tmp==tmp1)&&(strcmp(tmp2,tmp5)!=0)){
cout << zeile2 << endl;
}
}
in.clear();
in.seekg(merke);
}
return 0;
}
How can I prevent that double existing words will be shown.
Many thanks for reply


If you'd like feedback on /improving/ an existing program, please show a
complete, correct, compilable program (including #includes) to begin with.
What you've shown above has numerous errors, whether they be typos or
logical. You use several undefined identifiers, and the line
if ((tmp == tmp1) ...
is probably not doing what you think it is doing. There's just too much to
try and fix in order to see it run and get to the point of being able to
think about your question.
-leor
--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: download BD Software's free STL Error Message Decryptor at:
www.bdsoft.com/tools/stlfilt.html
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DK15798 | last post by:
Anybody think there is a way to solve the anagram problem (reading in a dictionary of words and printing out the anagrams for all words) with an open address hash table as opposed to a chained hash...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
2
by: jcollins1991 | last post by:
im trying to make a program thats supposed to check whether 2 strings are anagrams of each other (anagram = same letters in both strings, but in different orders... "cool as wet art" , and "cs at...
1
by: heloworld | last post by:
hi buddies.... i don ve any idea as how to solve an anagram problem... plz help me out....
19
by: dave | last post by:
Hi All, I wrote a program that takes a string sequence and finds all the words inside a text file (one word per line) and prints them: def anagfind(letters): #find anagrams of these letters...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.