c++ - Can't find my mistake! error: expected identifier before '(' token -


this main code, did search related mistakes before asking doesn't seem wrong...the ide says error in line 11.

#include<stdio.h> int main() {     float sal;     printf("digite o salário bruto: ");     scanf("%f",&sal);     if(sal<=2246.75){        printf("salário líquido :  ",sal);     }     else{         if(sal>2246.75)&&(sal<2995.70){             printf("salário líquido: ",sal * 0.925);         }         else{             if(sal>2995.70)&&(sal<=3743.19){                 printf("salário líquido: ",sal * 0.845);             }             else{                 printf("salário líquido: ", sal * 0.775);                 return 0;             }         }     } } 

if(sal>2246.75)&&(sal<2995.70){ 

the problem entire condition must placed within set of parentheses.

it's fine if want further enclose sub-conditions, must surround entire lot, too:

if ((sal > 2246.75) && (sal < 2995.70)) { 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -