Jump to content


Check out our Community Blogs

fire exit

Member Since 30 Jul 2007
Offline Last Active Dec 13 2009 05:01 AM
-----

Topics I've Started

i can fix my code. problem with pointer.

27 September 2007 - 11:24 PM

here is my code.

# include <iostream>
# include <string>
# include <fstream>
using namespace std;
int main () {
char *a;
char *b;
char *c;
ifstream word("word.txt");
while (!word.eof())
   {
   word>>c;   [COLOR="Red"]// line 14[/COLOR]
   a=c;   [COLOR="blue"] //line 15[/COLOR] 
   ifstream wordL ("wordlist.txt");
   while (!wordL.eof())
       {
        wordL >> c;    [COLOR="red"]// line 19 [/COLOR]
        b = c; [COLOR="blue"]//line 20[/COLOR]
        if (strlen(a)==strlen(b))
           { 
             cout<< lenght is equal;
            }
        }
    }
   cin.get();                                
}

note:
line 14 and 19 have the same variable where the string from the document is moved,coz when i put different variable the program run but a pop up appear saying "illegal operation".

line 16 and line 20 are the line where i move the content of the variable(where string from the document were moved) to another variable. Suppose to be, when line 19 is executed the string from document move to variable c but this is not exactly what happend the string of the document is also moved to variable a. that's why the if block is always true.

how can i fix this?
BTW,im using dev-C++

C++ read each character of the word?

25 September 2007 - 04:10 AM

another newbie question. how can i read or print each letter of a certain word?

convert character to Ascii in C++???

24 September 2007 - 07:43 PM

i am C++ noobies. how can i change a character into ascii then move it into variable?:confused:

asking for opensource compiler.

01 August 2007 - 06:37 PM

i am a programming graduate stuck in COBOL and want to learn new programming language. i am searching for a open source compiler. i already found 1 a C++ compiler DEV-C++ and starting to explore it. and also i want to learn VB 6.0, can you give me a link for its opensource?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download