I am just beginning with C++.
Can you write a basic/ simple program for each, that can show the outcome to.......
1. Sales * = 4++
2.Salary/=++4
I am just beginning with C++.
Can you write a basic/ simple program for each, that can show the outcome to.......
1. Sales * = 4++
2.Salary/=++4
you can't increment a constant like 4 or 21 or 0.89. therefore
sales *= 4++;
doesn't compute. However
sales *= 4;
expands to
sales = sales * 4;
You could do this:
int sales = 10;
int variable = 2;
sales *= variable++; which expands to
sales = sales * variable++;
and then do this to view what is in sales and variable
cout << sales << " *** " variable;
would print the following to the screen
20 *** 3
putting ++ or -- before a variable changes the variable before it is used in the expression, whereas putting ++ or -- after the variable changes the value of the variable after it is used in the expression.