Error

anyone know why i am getting this error?

1
2
  error: expected primary-expression before '!=' token
     if (hasLazer != true or hasRadar != true or hasSeild != true or hasAllies != true or hasSoftware != true){
Welcome!

To answer your question, no. Without further code, and besides using || instead of or, there is no way of telling what causes the misbehavior of your code. :)
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
33
34
35
void Observation(boss x){
  int move = 0;
  cout << "A massive T3000 bot stands infront of you, systems are targeting you what do you do?\n 1. Escape back to the elevator 2. Confront and kill the bot" << endl;
  usleep(1000000);
  cout << "@-CMBOT- ";
  cin >> move;
  
  if (killedBoss == true){
    cout << "You have already killed the bot, quicly escape...";
    elevator();
  }
  if (move == 1){
    cout << "You try to escape but the doors close to soon, the bots systems target you, you are destroyed" << endl;
    usleep(1000000);
    cout << "---GAME-OVER---";
  }
  if (move == 2){
    if (hasLazer != true or hasRadar != true or hasSeild != true or hasAllies != true or hasSoftware != true){
      cout << "You try to destory the bot, however your systems fail and you are destroyed" << endl;
      usleep(1000000);
      cout << "---GAME-OVER---";
    }
    if (hasLazer == true && hasRadar == true && hasSeild == true && hasAllies == true && hasSoftware == true){
      cout << "Your radar locks on..." << endl;
      usleep(1000000);
      cout << "Your allies target..." << endl;
      usleep(1000000);
      cout << "Your software locks into action..." << endl;
      usleep(1000000);
      cout << "Everthing fires at once and the Bot is destroyed, you gain the last bit of the code to lauch the ship... you must hurry";
      killedBoss = true;
      elevator();
    }
  } 
}
Are you sure that the error where in that line?

Anyway i see that in line 18 and line 23 there is the same control, you can use a function (for example funcontrol) that do the control (hasLazer == true && hasRadar == true && hasSeild == true && hasAllies == true && hasSoftware == true) and use !funcontrol in line 18 and funcontrol in line 23.

Furthermore, if you use a function type boolean that return a type boolean you can use only the name of function without the operator "!=" or "==".

You understand?
Registered users can post here. Sign in or register to post.