Primary Expression C++

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
#include <iostream>

using namespace std;

int main()
{
  int age = 0;

  cout<<"Please input your age: " <<endl;
  cin>> age;
  cin.ignore();
  if ( age >= 13 ) {
     cout<<"Sorry, you are just too young!\n" <<endl;
  }
    else if ( age >= 14 && <= 22 ) {
     cout<<"Your age is Perfect! Would you like to get a cup of Coffee?\n" <<endl;
  }
    else if ( age >= 22 && <= 99 ) {
     cout<<"Age might just be NUMBER!\n" <<endl;
  }
    else if ( age == 100 ) {
     cout<<"Simple Fact: You are OLD\n" <<endl;
  }
  else {
    cout<<"You are really Ancient\n" <<endl;
  }
  cin.get();
}


I get errors on line 15 and 18 that go like this:

C:\Users\DizzyD\Desktop\Project 1\Attempt 2\main.cpp||In function 'int main()':|
C:\Users\DizzyD\Desktop\Project 1\Attempt 2\main.cpp|15|error: expected primary-expression before '<=' token|
C:\Users\DizzyD\Desktop\Project 1\Attempt 2\main.cpp|18|error: expected primary-expression before '<=' token|
||=== Build finished: 2 errors, 0 warnings ===|


I'm using Code::Blocks 10.05, Windows Vista 32Bit

Any help at all, is great :) Thanks In Advance!!
Your problem on lines 15 and 18 is the same, you have forgotten to put "age" before the second condition, line 15 for example should read :

else if ( age >= 14 && age <= 22 ) {

also on line 12 you have age >= 13, it should be age <=13

hope this helped :)
Topic archived. No new replies allowed.