GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 23-Jan-2005, 16:17
crq crq is offline
New Member
 
Join Date: Jan 2005
Posts: 15
crq is on a distinguished road

syntax error ???


i have 2 methods that are both getting the same error. they are both operator overload methods that call each other.
the size() call they make works fine. i have tested that prior to adding these. the self is defined in an include .h file as *this.

if anyone sees the error, PLEASE let me know. i have a long way to go and a short time to get there!!(ha)

this is the error message i am getting:

lab2aa.C: In member function `bool IntArray:perator==(const IntArray&)
const':
lab2aa.C:80: syntax error before `}' token
lab2aa.C: In member function `bool IntArray:perator!=(const IntArray&)
const':
lab2aa.C:98: syntax error before `}' token
lab2aa.C: At global scope:
lab2aa.C:116: syntax error before `}' token


and here is the code:

CPP / C++ / C Code:
 
bool IntArray::
operator != ( const IntArray &rhs) const
{
        if ( size() == rhs.size() ) {
                return ( FALSE );
        }
        int i = 0;
        while ( i < size() ){
                if ( self[i] == rhs[i] ){ 
                        return ( TRUE );
                }
                else i++
        }
        return ( FALSE );
}

bool IntArray::
operator == ( const IntArray &rhs ) const
{
        if ( size() != rhs.size() ) {
                return ( FALSE ); 
        }
        int i = 0;
        while ( i < size() ){
                if ( self[i] != rhs[i] ){                      
                        return ( FALSE );
                }
                else i++
        }
        return ( TRUE );
}
 

THANKS
crq
Last edited by LuciWiz : 23-Jan-2005 at 16:34. Reason: Please insert your C code between [c] & [/c] tags
  #2  
Old 23-Jan-2005, 16:30
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,703
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by crq
i have 2 methods that are both getting the same error. they are both operator overload methods that call each other.
the size() call they make works fine. i have tested that prior to adding these. the self is defined in an include .h file as *this.

if anyone sees the error, PLEASE let me know. i have a long way to go and a short time to get there!!(ha)

this is the error message i am getting:

lab2aa.C: In member function `bool IntArray:perator==(const IntArray&)
const':
lab2aa.C:80: syntax error before `}' token
lab2aa.C: In member function `bool IntArray:perator!=(const IntArray&)
const':
lab2aa.C:98: syntax error before `}' token
lab2aa.C: At global scope:
lab2aa.C:116: syntax error before `}' token

Whenever you get a "syntax error" message that you don't understand, look at what's happening on the lines just before the line number in the error message. For example, maybe you have missing semicolon(s) here and there?

CPP / C++ / C Code:
               else i++

Regards,

Dave
  #3  
Old 23-Jan-2005, 16:57
crq crq is offline
New Member
 
Join Date: Jan 2005
Posts: 15
crq is on a distinguished road
THANKS SO MUCH!! i just can't even SEE anymore!!

(duh)
crq

Quote:
Originally Posted by davekw7x
Whenever you get a "syntax error" message that you don't understand, look at what's happening on the lines just before the line number in the error message. For example, maybe you have missing semicolon(s) here and there?

CPP / C++ / C Code:
               else i++

Regards,

Dave
 
 

Recent GIDBlogMeeting the local Iraqis by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] GUI programming with FLTK dsmith FLTK Forum 10 03-Oct-2005 15:41
What is "Ambigious symbol" ??*( a compilation error) small_ticket C++ Forum 2 07-Jan-2005 21:10
Error C2146: syntax error : missing ',' before identifier 'C4' mattchew008 C++ Forum 2 19-Dec-2004 06:06
Can enum have same name as class? crystalattice C++ Forum 3 08-Dec-2004 16:43
Hmm what seems to be the problem here? error C2061: syntax error pablowablo C++ Forum 5 12-Jun-2004 22:11

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:07.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.