What is the output for the following code fragment?
int var1 = 20;
cout << --var1;
cout << var1++;
The output of the given code fragment will be 19 and 19.
This is so because the first cout statement is used with a pre-decrement operator. This means that the value of the variable, var1, will be first decreased by 1 and then printed, while the decreased value will