Error expected primary-expression before '<' token

Hi, I keep getting these error messages and I'm not sure what I'm doing wrong. I defined all of my variables but the program will not compile. Can anyone tell me where I'm going wrong?

aircraft.cpp: In function ‘int main()’:
aircraft.cpp:27: error: expected primary-expression before ‘<’ token
aircraft.cpp:34: error: expected primary-expression before ‘<’ token
aircraft.cpp:38: error: expected primary-expression before ‘<’ token


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
30
31
32
#include <iostream>
using namespace std;
int main ()
{

  // Declared variables for speed, length, and years
  float speed, length, years;

  // Ask the user to enter the estimated speed in km/h
  cout << "What's the estimated speed of the aircraft in km/h? ";
  cin >> speed;

  // Aircraft traveling +1100km/h ask user for esimated length (meters)
  if (speed > 1100)
    cout << "What's the estimated length of the aircraft in meters? ";
      cin >> length;
  if (speed =<1100)
    cout << "How many years has the aircraft been in service? ";
      cin >> years;

  // Determine whether the aircraft is military or civilian
  if (length > 52)
    cout << "Civilian";
  if (length =< 52)
    cout << "Military";
  if (years > 7)
    cout << "Civilian";
  if (years =< 7)
    cout << "Military";

  return 0;
}
Last edited on
Lines 17,24,28: Your relational operator should be <=, not =<.

Last edited on
Thank you so much. This helped me out a lot. I feel silly for making this mistake but will know better next time :)
Topic archived. No new replies allowed.