enum - typedef enum problem

printf("Hello,i'm new to c++ programming and programming in general.I'm trying to build a console application in netbeans IDE 6.8 that counts time in 5 shorting algorithms.But i get errors in 2 lines
1
2
enum boolean {false ,true};
typedef enum boolean bool;
unexpected token false in first line and unexpected token boolean in second.Compiler give these errors
1
2
3
4
main.cpp:27: error: expected identifier before ‘false’
main.cpp:27: error: expected ‘}’ before ‘false’
main.cpp:27: error: expected unqualified-id before ‘false’
main.cpp:27: error: expected declaration before ‘}’ token
Any help?
thank you in advance");
scanf("%c",&answer);
Last edited on
these are the parts from the quick_short that use bool variables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
void quickSort(int numbers[],int array_size)
{
 		 q_sort(numbers, 0, array_size - 1);
}
void q_sort(int numbers[], int left, int right)
{
 		 int q;
  		if (left < right) {
    			q = partition(numbers, left, right);
    			q_sort(numbers,left, q);
    			q_sort(numbers, q+1, right);
  		}
}
int partition(int numbers[], int left, int right)
{
  		int x = numbers[left], i = left-1, j = right + 1, temp;
  		bool again = true;
  		while (again){
			do {} while (numbers[++i] < x);
			do {} while (numbers[--j] > x);
			if (i < j) {
				temp = numbers[i];
				numbers[i] = numbers[j];
				numbers[j] = temp;
			}
			else again = false;
 		}
  		return j;
}
false, true and bool are key words. you cannot redefine them that way
Topic archived. No new replies allowed.