1 Replies - 541 Views - Last Post: 20 February 2009 - 06:52 AM Rate Topic: -----

#1 mannie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 19-February 09

Easy Compiler Error

Posted 20 February 2009 - 06:36 AM

I'm not sure why I'm getting this compiler error:
while (choice < 1 || (choice > 1 && choice < 2) || (choice > 2 && choice < 3) ||
	  (choice > 3 && choice < 4) || (choice > 4 && < 5) || choice > 5)
{
	 cout << "Menu choices are 1 - 5" << endl;
	 choice = getMenuChoice();	
}


(25) : error C2059: syntax error : '<'
(26) : error C2143: syntax error : missing ';' before '{'

Line 25 = second line of while loop
Line 26 = line of the first bracket

Thank you

Is This A Good Question/Topic? 0
  • +

Replies To: Easy Compiler Error

#2 Bench  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 855
  • View blog
  • Posts: 2,338
  • Joined: 20-August 07

Re: Easy Compiler Error

Posted 20 February 2009 - 06:52 AM

it looks like you've missed out something here (choice > 4 && < 5)

You may be able to simplify your while condition to while( choice < 1 || choice > 5 ) . The other conditions would only be met if 'choice' is a floating point type such as double

This post has been edited by Bench: 20 February 2009 - 06:54 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1