I am having some issues with assigning a's and b's new values, using there old ones to calculate them.
My program output is always a=2 and b=1.
Can anybody help me with this please?
#include <iostream>
#include <cmath>
usingnamespace std;
int main()
{ int A, B;
cout << " Enter the values of A and B without a comma separating the values. \n";
cin >> A, B;
if (A > B)
{ A = A * B + 2; //I'm not sure how to write this???
B ++;
}
else
{ A = A / 2; //Also here
B = B + 4; // and here I'm having problems with the syntax
}
cout << "A = " << A << " B = " << B;
return 0;
}
Enter the values of A and B without a comma separating the values.
(any number) (and any number)
A = 2 B = 1