c++ - C++14 My program is not returning what is expected -


#include <stdio.h> #include <stdlib.h>   int main() {     //you in elevator now;      //define variables;     char a;     char b;      //ask questions;     printf("you in elevator now.\nplease enter floor want visit?\npress 'l' basement, '1' 1st floor, '2' 2nd floor, , '3' 3rd floor:\n");     scanf("%c", &a);      //display options;     if (a=='l'){         printf("you @ basement now.\n", a);      scanf("%c", &b);       printf("where want go?\nonly option 'p' parking lot:\n");           else (b=='p')            printf("you in parking lot now.\n", b);     }        else if (a=='1')         printf("you @ main floor now.\n", a);      else if (a=='2')         printf("you @ mechanical department now.\n", a);      else if (a=='3')         printf("you @ electrical department now.\n", a);      else{         printf("it's not option\n");     }  } 

for first option l after user selects p getting command not found. should getting in parking lot now. not sure causing this.

replace

else (b==='p') 

by

if (b == 'p') 

Comments