I was working on something just to practice building a menu so I can remember it for later.
The same error keeps coming up and I'm note sure what's wrong, could someone give me a hand.
haha, sorry, I'm new to this.
This is the code

#include "stdafx.h"
#include <iostream> 
#include <conio.h>
#include <cstdlib>

using namespace std;

int main ()

	char choice;
	for (;;){

	cout << "This is a program to test the menu system";
	cout << endl;
	cout << endl;
	cout << "1- option one\n";
	cout << "2- option two \n";
	cout << "3- option three \n";
	cin >> choice;
		}while choice ( choice < '1' || choice > '3' && choice != 'quit');
		if (choice == 'quit' ) break;
		switch (choice) {
			case '1' :
		cout << "TEST ONE";
			case '2':
		cout << "TEST TWO";
			case '3': 
			cout << "TEST THREE";

	getch ();
		return 0;
}while choice ( choice < '1' || choice > '3' && choice != 'quit');

This is your problem (Line 23). See the extra 'choice' between the 'while' and the parentheses? That can't be there.

Also, this part of the line:

&& choice != 'quit'

is not valid code. Your variable "choice" is defined as a char, not a char* (or array of char). As such, it can not hold a string. Additionally, a string literal is delimited with "double-quotes", not 'single-quotes'. To keep your declaration of "choice" valid, and be able to use it here, you'll want to define a single char that is used to indicate the user's intention to quit. For example, consider using 'x' to represent the user's choice to "exit".

yea, thanks :)
a little while after posting I noticed, it works now.
thanks :)

This article has been dead for over six months. Start a new discussion instead.