int main(){
int x=0,y=0,temp=0; //Always declare variables at the "top", if possible pre-assign or initialize them with a value.
cout <<"A 4x4 multiplication table\n";
cout <<"Provide X value (between 1 to 5)\n";
cin >>x;
temp=x;
cout <<"Provide Y value (between 1 to 5)\n";
cin >>y;
^^^^^ That is the program, I type 5 for X and 5 for Y as well. My output ends up showing 5 10 15 20 25 on the top first line, but my friend's top first line shows different numbers. Could you help me edit this program so that me and my friend both get the same output, or in other words to get the same answers in any C++ compiler? Thanks for the help in advance!
Yes it works, but the answers when I type 5 & 5 aren't the same when he types 5 &5. We are running different windows versions, but have the same Dev C++ compiler.
You have a chain of operators in same statement. cout << A << B << C;
It is deterministic that the value of A is printed first, then the value of B and last the value of C. However, the code has to compute the values of A, B and C before they are passed to the << operator. Those three computations are not ordered and can be evaluated in whatever order.
Shoot I haven't learned that, any chance you could edit my program to include it, and afterwards paste here? If you don't have the time to do so I totally understand.