For cases such as : x , - x , + x
else if ( equation [ j ] == ' x ' ) { if ( ( i == j ) equation [ j - 1 ] == ' + ' ) coeff += sign ; else if ( equation [ j - 1 ] == ' - ' ) coeff -= sign ; else coeff += sign * stoi ( equation . substr ( i , j - i ) ) ; i = j + 1 ; }