I am asking help to understand: - In this program:
#include <iostream> int main() { int j = 0; int k = 1; int m = -1; int n = 1; int p = ((j * 300) - (4 * n) - (7 * m)); if (int l = ((j * 300) - (4 * n) - (7 * m)) > 0) { std::cout << "l is egual: " << l - 1 << std::endl; } else { std::cout << "l is negative: " << l << std::endl; } if (p > 0) { std::cout << "p is egual: " << p - 1 << std::endl; } else { std::cout << "p is negative: " << p << std::endl; } return 0; } I got the output: gcc circonfEn.cc -lstdc++ -o circonfEn ./circonfEn
l is egual: 0 p is egual: 2
Why the instruction in the if do not work?