Error: missing ' ) ' before identifier 'or'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmot
    New Member
    • Feb 2007
    • 8

    Error: missing ' ) ' before identifier 'or'

    Code:
    void Process_Sentence (void) /*Process sentences for counting words and lines*/
    {
    	Sent_Word = 0;
    
    	do
    	{
    		Non_Word_Character();
    		if (Succ_New_Line < 2)
    		{	
    			Succ_New_Line = 0;
    			Word_Character();
    				Sent_Word++;
    		}
    			
    	}while (Next_Char != '.' or '?' or '!') & (Succ_New_Line < 2 );
    
    }

    Above is a piece of code to add 1 to a count when a full stop, question mark or exclamation mark is used. However when I try and compile it tells me that:

    missing ' ) ' before identifier 'or'.

    Can anyone help???
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    You should use || instead of or.

    Comment

    • RedSon
      Recognized Expert Expert
      • Jan 2007
      • 4980

      #3
      Do you have any expierence writing c/c++ code? Have you been able to build and compile a hello world app? I think you would benefit alot from reading this.

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        And this, espically the do-while loop section.

        Comment

        • dmot
          New Member
          • Feb 2007
          • 8

          #5
          Originally posted by Ganon11
          You should use || instead of or.
          I've done that and it now tells me that:

          '&' requires l-value

          Can you help with this?

          Comment

          • RedSon
            Recognized Expert Expert
            • Jan 2007
            • 4980

            #6
            Originally posted by dmot
            I've done that and it now tells me that:

            '&' requires l-value

            Can you help with this?
            Did you read the information on cplusplus website? What you are doing is making extreamly novice errors that tell me that this might be your first time ever writing code in c/c++. It takes a long time to get started and to learn the syntax and I am not patient enough to hold your hand through it. You need to be a self-starter and work through some of the tutorials provided on this site and the cplusplus site.

            However, I will give you this one freebie. The condition of a while loop must have distict boolean statements in oder to make sense.

            So it is bad if you do this
            Code:
            while ( aNum != 0 || 1 || 2 || 3)
            It needs to be
            Code:
            while (aNum != 0 || aNum != 1 || aNum !=2 ... and so on)
            Each element between the || operators evaluates to either true or false.

            Comment

            • dmot
              New Member
              • Feb 2007
              • 8

              #7
              Originally posted by RedSon
              Do you have any expierence writing c/c++ code? Have you been able to build and compile a hello world app? I think you would benefit alot from reading this.
              I have no experience as I am currently doing a course in it. This is my first assignment and is due in tuesday. Am currently trying to work out the errors when I compile.

              Comment

              • RedSon
                Recognized Expert Expert
                • Jan 2007
                • 4980

                #8
                I can tell this is your first assignment. If you have a textbook you should take an hour and read through the chapters your instructor has asked you to read. If you still do not understand what is going on, then the next step is to contact your instructor and ask them for help. After all that is why they are getting paid, to teach you something. If that doesnt work try working through some tutorials online written by much smarter people then myself. Lastly if you are still haveing problems then post your code again, and describe what you think the problems are and what you think the solution is.

                Comment

                Working...